#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define BARS 8
#define BAR_WIDTH 16
uint16_t drawRGB24toRGB565(uint8_t r, uint8_t g, uint8_t b) {
return ((r / 8) << 11) | ((g / 4) << 5) | (b / 8);
}
uint16_t colors[] = {
drawRGB24toRGB565(0xFF, 0, 0),
drawRGB24toRGB565(0, 0xFF, 0),
drawRGB24toRGB565(0, 0, 0xFF),
drawRGB24toRGB565(0xFF, 0xFF, 0),
drawRGB24toRGB565(0xFF, 0, 0xFF),
drawRGB24toRGB565(0, 0xFF, 0xFF),
drawRGB24toRGB565(0, 0, 0),
drawRGB24toRGB565(0xFF, 0xFF, 0xFF)
};
void setup() {
Serial.begin(115200);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.display();
delay(2000);
display.clearDisplay();
for (int b = 0; b < BARS; ++b) {
display.fillRect(0+(b*BAR_WIDTH), 0, BAR_WIDTH, display.height(), colors[b]);
}
display.display();
delay(2000);
}
void loop() {
int sample = analogRead(A0);
Serial.println(sample);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
mic:1
mic:2
oled1:GND
oled1:VCC
oled1:SCL
oled1:SDA