|
@@ -2,6 +2,9 @@
|
|
|
|
|
|
#include "version.h"
|
|
#include "version.h"
|
|
|
|
|
|
|
|
+const long REFERENCE_VOLTAGE_mV = 5000;
|
|
|
|
+const long ANALOG_READ_MAX = 2 << 10 - 1;
|
|
|
|
+
|
|
const uint8_t DISPLAY_WIDTH = 128;
|
|
const uint8_t DISPLAY_WIDTH = 128;
|
|
const uint8_t DISPLAY_HEIGHT = 64;
|
|
const uint8_t DISPLAY_HEIGHT = 64;
|
|
// https://startingelectronics.org/tutorials/arduino/modules/OLED-128x64-I2C-display/
|
|
// https://startingelectronics.org/tutorials/arduino/modules/OLED-128x64-I2C-display/
|
|
@@ -25,13 +28,16 @@ void setup() {
|
|
display.println(PROJECT_VERSION);
|
|
display.println(PROJECT_VERSION);
|
|
display.display();
|
|
display.display();
|
|
delay(2000);
|
|
delay(2000);
|
|
- display.setTextSize(5);
|
|
+ display.setTextSize(4);
|
|
}
|
|
}
|
|
|
|
|
|
void loop() {
|
|
void loop() {
|
|
display.clearDisplay();
|
|
display.clearDisplay();
|
|
display.setCursor(0, 0);
|
|
display.setCursor(0, 0);
|
|
- display.print(analogRead(A0));
|
|
+ display.println(
|
|
|
|
+ (long)analogRead(A0) * REFERENCE_VOLTAGE_mV / ANALOG_READ_MAX
|
|
|
|
+ );
|
|
|
|
+ display.print("mV");
|
|
display.display();
|
|
display.display();
|
|
delay(100); // ms
|
|
delay(100); // ms
|
|
}
|
|
}
|