Problems with Serial Monitor and LCD screen


hello everyone,
i try make code. in code, user type text in serial monitor, arduino shows typed text on lcd display, piezo element gives 3 tones , arduino have scroll display show whole text.

here code have made:
code: [select]

#include <liquidcrystal.h>
liquidcrystal lcd(12, 11, 5, 4, 3, 2);
boolean pieper = false;
string alpha;
int aantal = 0;

void setup() {
  // set lcd's number of columns , rows:
  lcd.begin(16, 2);
  // initialize serial communications:
  serial.begin(9600);
  pinmode(8, output);
}

void loop() {
  // when characters arrive on serial port...
  if (serial.available()) {
    // clear screen
    lcd.clear();
    // read available characters
    while (serial.available() > 0) {
      // display each character lcd
      lcd.write(serial.read());
      pieper = true;
      aantal = serial.available();
      serial.println("aantal: "+aantal);
    }
  }

  if(pieper == true) {
    for(int i=0; i<3; i+=1) {
      tone(8, 1420, 500);
      delay(500);
      tone(8, 2021, 500);
      delay(500);
      tone(8, 2950, 500);
      delay(500);
      notone(8);
      delay(1000);     
    }
    pieper = false;
  }


 
}


the problem don't know how arduino have scroll automaticaly left, showing text. have found scrolldisplayleft command, how can program arduino scrolls automaticaly left, text displayed (the length of text not equal time)?

regards,
daan70

quote
the problem don't know how to
the problem don't know how read packet.

look @ sentence above. can see expresses complete thought (is complete packet) because ends period. period end of packet marker.

you must read , store data when arrives, until end of packet marker arrives. then, you'll have idea how data there display, , you'll know whether statically show or use scrolling.

right now, haven't clue how data there display.


Arduino Forum > Using Arduino > Programming Questions > Problems with Serial Monitor and LCD screen


arduino

Comments