/* Project to interface a screen connected to an arduino with data from a vash script. Used as start up for a HTPC. */ // OLED thingies #include #include #include #include //Functionality #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 }; #if (SSD1306_LCDHEIGHT != 32) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif // Vars String inputString = ""; // a string to hold incoming data boolean stringComplete = false; // whether the string is complete boolean repeat = false; boolean shuffle = false; int volume = 100; String title = "Yesterdays"; String artist = "Guns 'n Roses"; String album = "Appetite for Destruction"; unsigned int tick = 0; unsigned int maxticks = 0; void setup() { // initialise serial Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) // init done display.clearDisplay(); display.display(); delay(500); layout(tick); calcMaxTicks(); while(!Serial); } void loop() { // print the string when a newline arrives: if (stringComplete) { setFromSerial( inputString ); // clear the string: inputString = ""; stringComplete = false; } layout(tick++); if ( tick > maxticks ) tick = 0; delay(500); }