diff --git a/src/Dezibot.cpp b/src/Dezibot.cpp index 509f068..3285444 100644 --- a/src/Dezibot.cpp +++ b/src/Dezibot.cpp @@ -19,21 +19,33 @@ // On an arduino MEGA 2560: 20(SDA), 21(SCL) // On an arduino LEONARDO: 2(SDA), 3(SCL), ... #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) -#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 +#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 + Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #define GPIO_LED 48 void Dezibot::begin(void) { Adafruit_NeoPixel ledStrip = Adafruit_NeoPixel(3, GPIO_LED, NEO_GRB + NEO_KHZ800); + Wire.begin(1, 2); if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { - Serial.println(F("SSD1306 allocation failed")); + Serial.println("SSD1306 allocation failed"); for (;;); // Don't proceed, loop forever } + display.display(); + vTaskDelay(2000); display.clearDisplay(); + vTaskDelay(2000); + + // Draw a single pixel in white display.drawPixel(10, 10, SSD1306_WHITE); + // Show the display buffer on the screen. You MUST call display() after + // drawing commands to make them visible on screen! + display.display(); + vTaskDelay(2000); + Serial.begin(9600); Serial.println("start"); @@ -57,5 +69,14 @@ void Dezibot::begin(void) { Serial.println(time_us); + display.clearDisplay(); + + display.setTextSize(2); // Draw 2X-scale text + display.setTextColor(SSD1306_WHITE); + display.setCursor(10, 0); + display.println(F("scroll")); + display.display(); // Show initial text + vTaskDelay(1000); + } } \ No newline at end of file