Столкнулся с ошибкой при попытке вывести строку, полученную из терминала ардуино длинною в 16 символов через функцию lcd.print
Используется LCD widget, ADVANCED mode. По описанию на сайте должен выводить 2 строки по 16 символов.
До 15 символов выводит корректно, если 16 выдает через сериал ошибку:
Exception (9):
epc1=0x40205412 epc2=0x00000000 epc3=0x00000000 excvaddr=0x3ffef00d depc=0x00000000
ctx: cont
sp: 3fff0230 end: 3fff0450 offset: 01a0
stack>>>
3fff03d0: 3ffef09c 3ffef00d 3ffef0b8 4020486c
3fff03e0: 00000000 00000000 3ffef0b8 402025dc
3fff03f0: 00000000 00000000 3ffef0b8 40202ecd
3fff0400: 00000012 3ffef35c 3ffef35c 3ffef41c
3fff0410: 00000000 00001ef5 3ffef0b8 3ffef41c
3fff0420: 3fffdad0 00000000 3ffef414 40203917
3fff0430: 3fffdad0 00000000 3ffef414 40205224
3fff0440: feefeffe feefeffe 3ffef430 40100710
<<<stack<<<
?2⸮⸮?⸮ȩ
Потом перегружается и опять работает.
WeMos D1R1
IPhone 6, IOS 11.4.1
Blynk server
Blynk Library version blynk-library-0.5.3
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "******";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*****";
char pass[] = "*******";
char com [16];
String str1_LCD;
WidgetLCD lcd(V5);
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V0)// Нажатие кнопки Select
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
lcd.print(0, 0, "V1 Slider value is: "); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//Serial.print("V1 Slider value is: ");
if (pinValue == 0)
{
Serial.println("!S");
lcd.clear(); //Use it to clear the LCD Widget
}
else
{
Serial.println("S");
lcd.print(0, 1, "Button S");
}
}
BLYNK_WRITE(V1) // Нажатие кнопки Up
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
lcd.print(0, 0, "V1 Slider value is: "); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//Serial.print("V1 Slider value is: ");
if (pinValue == 0)
{
Serial.println("!U");
lcd.clear(); //Use it to clear the LCD Widget
}
else
{
Serial.println("U");
lcd.print(0, 1, "Button UP");
}
}
BLYNK_WRITE(V2)// Нажатие кнопки Left
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
lcd.print(0, 0, "V1 Slider value is: "); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//Serial.print("V1 Slider value is: ");
if (pinValue == 0)
{
Serial.println("!L");
lcd.clear(); //Use it to clear the LCD Widget
}
else
{
Serial.println("L");
lcd.print(0, 1, "Button LEFT");
}
}
BLYNK_WRITE(V3)// Нажатие кнопки Down
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
lcd.print(0, 0, "V1 Slider value is: "); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//Serial.print("V1 Slider value is: ");
if (pinValue == 0)
{
Serial.println("!D");
lcd.clear(); //Use it to clear the LCD Widget
}
else
{
Serial.println("D");
lcd.print(0, 1, "Button DOWN");
}
}
BLYNK_WRITE(V4)// Нажатие кнопки Right
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
lcd.print(0, 0, "V1 Slider value is: "); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
//Serial.print("V1 Slider value is: ");
if (pinValue == 0)
{
Serial.println("!R");
lcd.clear(); //Use it to clear the LCD Widget
}
else
{
Serial.println("R");
lcd.print(0, 1, "Button RIGHT");
}
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
lcd.clear(); //Use it to clear the LCD Widget
}
void my_Print()
{
if (Serial.available()) // Пока в буфере есть данные
{
//lcd.clear(); //Очистка дисплея
str1_LCD = "";
int i;
int j = Serial.available();
Serial.println (j);
for ( i=0; i < j+1 ; i++ )
{
com[i] = Serial.read(); // Последовательно считываем из буфера по байтам
Serial.print ("com");
Serial.print (i);
Serial.print ("=");
Serial.println ( com[i]);
if ( com[i] == 13 || i > 15 ) break; // Если перевод строки - прекращаем
str1_LCD = String (str1_LCD + com[i]);
Serial.println (str1_LCD);
}
Serial.print ("Value is:");
Serial.println (str1_LCD);
lcd.print(0, 0,String (str1_LCD)); //Выводим на первую строку дисплея
Serial.read();
return;
}
}
void loop()
{
Blynk.run();
my_Print();
}