🔍

THE SOLAR CONSOLE


#include <Arduino.h>

// GxEPD_MinimumExample by Jean-Marc Zingg
// PINS ON ESP32
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
  
#include <GxEPD.h>

// select the display class to use, only one, copy from GxEPD_Example
 #include <GxGDEW042T2/GxGDEW042T2.h>      // 4.2" b/w
  
  
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
  
GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16); // arbitrary selection of 17, 16
GxEPD_Class display(io, /*RST=*/ 16, /*BUSY=*/ 4); // arbitrary selection of (16), 4
 
int BTN_PIN = 2;

 int step = 0;
 
void setup() {
  
   display.init();
   display.eraseDisplay();
  // display.fillScreen(GxEPD_BLACK);
   display.setRotation(1);
   display.update();
  
  pinMode(BTN_PIN,INPUT);
}

void showBlackBoxCallback(uint32_t v)
{
   
}

void loop() {
  // put your main code here, to run repeatedly:

  bool dwn = digitalRead(BTN_PIN);
   

   if(dwn){
   step = int(random(10));


    display.fillScreen(GxEPD_WHITE);

   for(int i=0;i<133;i++){
    int rr = int(random(20)+4);
    display.fillCircle(int(random(300)),int(random(400)),rr,GxEPD_BLACK);
    //display.fillCircle(int(random(400)),int(random(300)),22,GxEPD_WHITE);
  }
  
  

 
  
  display.setCursor(6,step*40);
  display.setTextSize(2);
  display.setTextColor(GxEPD_WHITE);
  display.print("SECTION");
  display.print( step );
   display.updateWindow(0, 40*step, 300, 34, true);
}
  // display.updateWindow()
   //display.drawPagedToWindow(showBlackBoxCallback, 0, 40*step, 400, 40, GxEPD_BLACK);
   delay(20);
}