#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
// put your setup code here, to run once:
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
}
void loop() {
// put your main code here, to run repeatedly:
display.setTextSize(1); // text size
display.setTextColor(WHITE); // text color
display.setCursor(0, 0); // position to display
display.print("Sensor Value:"); // text to display
display.print(analogRead(A0));
display.display(); // show on OLED
delay(500);
display.clearDisplay();
}
Loading
ssd1306
ssd1306