Hi !
Facing problem to print on lcd, even same value is printing via serial.println.
I am receiving one string (comma delimited) using interrupt. ; works ok
Now in loop i am split string.; works ok
Now i convert string to int, i print on serial.println, works ok
but when i want to print same value on lcd, only 0 is printing ?
I put some code in setup to test, in set up same code working fine but in loop does not work.
here is my loop code
void loop() {
if (stringComplete){
//Serial.print(inputString);
stringComplete = false;
digitalWrite(buz,HIGH);
value1 = getValue(inputString,',',1);
value2 = getValue(inputString,',',2);
value3 = getValue(inputString,',',3);
v1 = value1.toInt();
v2 = value2.toInt();
v3 = value3.toInt();
lcd.setCursor(12,0);
lcd.print(v1,DEC);
lcd.print(char(223));
lcd.print(" ");
lcd.setCursor(12,1);
lcd.print(v2,DEC);
lcd.print(" ");
//Serial.println(value2);
//Serial.println(value3);
Serial.println(v1);
Serial.println(v2);
Serial.println(v3);
digitalWrite(buz,LOW);
inputString = "";
}
Can some on help ?
pylon
2
Post complete code and describe in detail which part of the code doesn't work for you.
BTW: don't use the String class on Arduinos (at least the AVR models), it fragments the memory and sooner than you might think you run out of it.
AJB2K3
3
Check your
Serial.Print();
lines and compare to your
lcd.print();
lines then look up the reference for lcd.print();
Run this version and report back with what shows on Serial Monitor:
void loop()
{
if (stringComplete)
{
stringComplete = false;
digitalWrite(buz, HIGH);
Serial.print("Input: \"");
Serial.print(inputString);
Serial.print("\" Values: \"");
value1 = getValue(inputString, ',', 1);
value2 = getValue(inputString, ',', 2);
value3 = getValue(inputString, ',', 3);
Serial.print(value1);
Serial.print("\", \"");
Serial.println(value2);
Serial.print("\", \"");
Serial.print(value3);
Serial.print("\" Numbers: ");
v1 = value1.toInt();
v2 = value2.toInt();
v3 = value3.toInt();
Serial.print(v1, DEC);
Serial.print(", ");
Serial.print(v2, DEC);
Serial.print(", ");
Serial.println(v3, DEC);
lcd.setCursor(12, 0);
lcd.print(v1, DEC);
lcd.print(char(223));
lcd.print(" ");
lcd.setCursor(12, 1);
lcd.print(v2, DEC);
lcd.print(" ");
digitalWrite(buz, LOW);
inputString = "";
}