|
@@ -0,0 +1,32 @@
|
|
|
+#include <Adafruit_SSD1306.h>
|
|
|
+
|
|
|
+#include "version.h"
|
|
|
+
|
|
|
+const uint8_t DISPLAY_WIDTH = 128;
|
|
|
+const uint8_t DISPLAY_HEIGHT = 64;
|
|
|
+// https://startingelectronics.org/tutorials/arduino/modules/OLED-128x64-I2C-display/
|
|
|
+const uint8_t DISPLAY_I2C_ADDRESS = 0x3C;
|
|
|
+
|
|
|
+Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
|
|
+
|
|
|
+void setup() {
|
|
|
+ // $ stty -F /dev/ttyUSB0 | grep speed
|
|
|
+ Serial.begin(115200);
|
|
|
+ Serial.println(PROJECT_REPO_URL);
|
|
|
+ Serial.println(PROJECT_VERSION);
|
|
|
+ if (!display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_I2C_ADDRESS)) {
|
|
|
+ Serial.println("failed to init display");
|
|
|
+ while (true)
|
|
|
+ ;
|
|
|
+ }
|
|
|
+ display.display();
|
|
|
+}
|
|
|
+
|
|
|
+void loop() {
|
|
|
+ Serial.println("invertDisplay(true)");
|
|
|
+ delay(1000); // ms
|
|
|
+ display.invertDisplay(true);
|
|
|
+ Serial.println("invertDisplay(false)");
|
|
|
+ delay(1000); // ms
|
|
|
+ display.invertDisplay(false);
|
|
|
+}
|