Skip to content

Instantly share code, notes, and snippets.

@sisomm
Created December 30, 2013 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sisomm/8186792 to your computer and use it in GitHub Desktop.
Save sisomm/8186792 to your computer and use it in GitHub Desktop.
Arduino Scetch to display what´s coming on the serial port
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
char commandbuffer[100];
int readserial()
{
int i=0;
if(Serial.available()){
delay(100);
while( Serial.available() && i< 99) {
commandbuffer[i++] = Serial.read();
}
commandbuffer[i++]='\0';
}
return i;
}
void setup()
{
Serial.begin(9600);
Serial.flush();
lcd.begin(16, 2);
lcd.clear();
lcd.print("Hei!");
}
void loop()
{
lcd.setCursor(0,0);
int i = readserial();
if(i>0){
lcd.clear();
lcd.print((char*)commandbuffer);
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment