Skip to content

Instantly share code, notes, and snippets.

@kenchris
Created March 30, 2016 08:55
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 kenchris/69779fa6578ee8ec9bceaf45447a7ec2 to your computer and use it in GitHub Desktop.
Save kenchris/69779fa6578ee8ec9bceaf45447a7ec2 to your computer and use it in GitHub Desktop.
#include <WebUSB.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define Serial WebSerial
const int redPin = 7;
const int greenPin = 6;
const int bluePin = 5;
String content = "";
int index;
void setup() {
lcd.begin(16, 2);
while (!Serial) {
;
}
Serial.begin(9600);
Serial.write("Sketch begins.\r\n");
index = 0;
}
void loop() {
content = "";
while (Serial && Serial.available()) {
char ch = Serial.read();
content.concat(ch);
}
if (content == "")
return;
Serial.println(content);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(content.substring(0, 16));
lcd.setCursor(0, 1);
lcd.print(content.substring(16));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment