Skip to content

Instantly share code, notes, and snippets.

@atotto
Created February 4, 2020 13:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atotto/be94e44b72c614dca84ccc395554590e to your computer and use it in GitHub Desktop.
Save atotto/be94e44b72c614dca84ccc395554590e to your computer and use it in GitHub Desktop.
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#define EPD_CS SS
GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
#define BAT 35
void setup() {
pinMode(BAT, INPUT);
//float volt = (long)analogRead(BAT) * 3300. / 4096. * 2. ;
float volt = (long)analogRead(BAT) * 3600. / 4095. * 2. ;
display.init(115200);
display.firstPage();
do
{
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
display.setFullWindow();
display.setCursor(0, 10);
display.print(String((long)volt) + " mV");
}
while (display.nextPage());
display.hibernate();
}
void loop(void) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment