How to make a narrative on an LCD screen:
-> the colours have to change
-> you have two times 16 characters
-> every time you print a text on the screen, it has to be reset to it’s initial position
Here’s a video of the first narrative I made for the “Big Fat Failed Beginnings” performance for the Belluard Bollwerk Festival.
My code for the Arduino & the screen worked, but it was not very elegant, so I asked for some help on the Belgian hackerspaces “universal knowledge list”. I added some functions.
Thanks everyone!
#include
// Create a software serial port!
SoftwareSerial lcd = SoftwareSerial(0,2);// Create a function to easily determine colour
// To determine colour, use: setColour(&lcd, 1, 1, 255)
void setColour(SoftwareSerial* lcd, char r, char g, char b) {
lcd->write(0xFE);
lcd->write(0xD0);
lcd->write(r);
lcd->write(g);
lcd->write(b);
delay(10);
}// Elegantly clear screen
// Use setClear
void setClear(){
lcd.write(0xFE);
lcd.write(0x58);
delay(10);
}// go ‘home’
// Use setHome
void setHome(){
lcd.write(0xFE);
lcd.write(0x48);
delay(10);
}void setup() {
lcd.begin(9600);// set the size of the display if it isn’t 16×2 (you only have to do this once)
lcd.write(0xFE);
lcd.write(0xD1);
lcd.write(16); // 16 columns
lcd.write(2); // 2 rows
delay(10);
// we suggest putting delays after each command to make sure the data
// is sent and the LCD is updated.// set the contrast, 200 is a good place to start, adjust as desired
lcd.write(0xFE);
lcd.write(0x50);
lcd.write(200);
delay(10);// set the brightness – we’ll max it (255 is max brightness)
lcd.write(0xFE);
lcd.write(0x99);
lcd.write(255);
delay(10);// turn off cursors
lcd.write(0xFE);
lcd.write(0x4B);
lcd.write(0xFE);
lcd.write(0x54);// clear screen
setClear();// go ‘home’
setHome();}
void loop() {
// adjust colors and define RGB values
// Colour as neutral as possible
setColour(&lcd, 255, 220, 200);lcd.println(“When does an”); //println gives new line for the next sentence
lcd.print(“incident “);
delay(3000);
setClear();
setHome();lcd.println(“become”); //println gives new line for the next sentence
lcd.print(“a disaster?”);
delay(3000);
setClear();
setHome();lcd.println(“It’s a question”); //println gives new line for the next sentence
lcd.print(” of scale.”);
delay(3000);
setClear();
setHome();lcd.println(“**INCIDENT”); //println gives new line for the next sentence
lcd.print(” OCCURS**”);
delay(3000);
setClear();
setHome();// adjust colors and define RGB values
// Colour Blue
setColour(&lcd, 1, 1, 255);
lcd.println(“The BLUE LIGHTS”); //println gives new line for the next sentence
lcd.print(” come in.”);//Text written in colour
delay(3000);
setClear();
setHome();lcd.print(“Police-Ambulance”); //println gives new line for the next sentence
lcd.print(” Firebrigade”);//Text written in colour
delay(3000);
setClear();
setHome();lcd.println(“They judge, act”); //println gives new line for the next sentence
lcd.print(” communicate”);
delay(3000);
setClear();
setHome();lcd.println(“When they need”); //println gives new line for the next sentence
lcd.print(“extra force”);
delay(3000);
setClear();
setHome();// adjust colors and define RGB values
// Colour orangesetColour(&lcd, 255, 20, 1);
lcd.println(“CODE ORANGE”); //println gives new line for the next sentence
lcd.print(” is activated”);
delay(3000);
setClear();
setHome();lcd.print(“Civil Protection”); //println gives new line for the next sentence
lcd.print(” “);
delay(3000);
setClear();
setHome();lcd.println(“and Technical”); //println gives new line for the next sentence
lcd.print(“Services”);
delay(3000);
setClear();
setHome();lcd.println(“join the”); //println gives new line for the next sentence
lcd.print(“Blue Lights”);
delay(3500);
setClear();
setHome();lcd.println(“In case of a “); //println gives new line for the next sentence
lcd.print(“MAJOR DISTASTER”);
delay(3500);
setClear();
setHome();// adjust colors and define RGB values
// Colour REDsetColour(&lcd, 255, 1, 1);
lcd.println(” CODE RED”); //println gives new line for the next sentence
lcd.print(” is triggered”);
delay(3500);
setClear();
setHome();lcd.println(“If necessary”); //println gives new line for the next sentence
lcd.print(“the army comes”);
delay(3500);
setClear();
setHome();lcd.println(“For every”); //println gives new line for the next sentence
lcd.print(“catastrophy,”);
delay(3500);
setClear();
setHome();lcd.println(“plans have been”); //println gives new line for the next sentence
lcd.print(“made..”);
delay(4000);
setClear();
setHome();lcd.println(” “); //println gives new line for the next sentence
lcd.print(” “);
delay(3000);
setClear();
setHome();}