Here is the "sketch". Which is the code used to program the Arduino.
It still needs a lot of work.
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
String data="";
const int lf = 10;
const int green = 13;
const int yellow = 7;
const int red = 8;
String artist="";
String song="";
void setup() {
pinMode(green,OUTPUT);
pinMode(yellow,OUTPUT);
pinMode(red,OUTPUT);
// set up the number of columns and rows on the LCD
lcd.begin(16, 2);
Serial.begin(9600);
data.reserve(80);
lcd.print("Waiting for...");
// set the cursor to column 0, line 1
// line 1 is the second row, since counting begins with 0
lcd.setCursor(0, 1);
// print to the second line
lcd.print("serial input");
}
void loop() {
delay(250);
}
void serialEvent() {
data="";
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the data:
if (inChar == (char)10)
{break;}
data += inChar;
}
if (data=="Mode: On")
{
digitalWrite(green,HIGH);
digitalWrite(yellow,LOW);
digitalWrite(red,LOW);
}
else if (data=="Mode: Standby")
{
digitalWrite(green,LOW);
digitalWrite(yellow,HIGH);
digitalWrite(red,LOW);
}
else if (data=="Mode: Off")
{
digitalWrite(green,LOW);
digitalWrite(yellow,LOW);
digitalWrite(red,HIGH);
}
else if (data.startsWith ("artist:"))
{
artist = data.substring(7);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(song);
lcd.setCursor(0, 1);
lcd.print("A: "+artist);
}
else if (data.startsWith ("song:"))
{
song = data.substring(5);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(song);
lcd.setCursor(0, 1);
lcd.print("A: "+artist);
}
else
{
lcd.clear();
lcd.print(data);
}
data="";
}