Created
March 30, 2016 08:55
-
-
Save kenchris/69779fa6578ee8ec9bceaf45447a7ec2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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