I tried to send a text via serial port on Digo but it only display 0. Instead, If I send L1, L2, L332 it shows just fine. What should I change? Or what did I do wrong. I have attached the code. http://www.digole.com//images/file/Tech_Data/Digole_Serial_Display_Adapter-Manual.pdf
/*----------NOTE----------
UART I2C SPI
OLD 8998 8988 9132
NEW 6966 7566 6354
---------------------*/
int state;
/*------------------------*/
#define _Digole_Serial_I2C_ //To tell compiler compile the special communication only,
#include <DigoleSerial.h>
#if defined(_Digole_Serial_I2C_)
#include <Wire.h>
DigoleSerialDisp mydisp(&Wire,'\x27'); //I2C:Arduino UNO: SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5 on UNO and Duemilanove
#endif
#define LCDCol 16
#define LCDRow 2
#define SC_W 160 //screen width in pixels
#define SC_H 128 //screen Hight in pixels
void resetpos(void) //for demo use, reset display position and clean the demo line
{
mydisp.setPrintPos(0, 1, _TEXT_);
delay(1500); //delay 2 seconds
mydisp.println(" "); //display space, use to clear the demo line
mydisp.setPrintPos(0, 1, _TEXT_);
}
void setup() {
Serial.begin(9600);
mydisp.begin();
/*----------for text LCD adapter and graphic LCD adapter ------------*/
mydisp.clearScreen(); //CLear screen
//mydisp.displayConfig(1); //set config display ON, 0=off
// mydisp.setI2CAddress(0x27); //this function only working when you connect using I2C, from 1 to 127
//delay(1000);
//mydisp.setLCDColRow(16,2); //set LCD Col and Row, only time set up is OK
mydisp.disableCursor(); //disable cursor, enable cursore use: enableCursor();
mydisp.drawStr(3, 0, "Display ON"); //display string at: x=4, y=0
/*------------------------*/
}
void loop() {
if (Serial.available()>0) {
if (Serial.peek() == 'L') {
Serial.read();
state = Serial.parseInt();
mydisp.displayConfig(0);
mydisp.setPrintPos(0, 1, _TEXT_);
mydisp.println(state);
}
while (Serial.available() > 0){ //Discard everything that we didn't expect
Serial.read();
}
}
}