#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define i2c_Address 0x3c
#define OLED_RESET -1
Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &Wire, OLED_RESET);
void setup(){
Serial.begin(115200);
display.begin(i2c_Address, true);
display.clearDisplay();
display.display();
}
void loop(){
int v= analogRead(0);
if(v>765) v=765;
//Serial.println(map(v, 0, 765, 0, 120));
//Serial.println(analogRead(A0));
display.fillRoundRect(4, 30, map(v, 0, 765, 0, 120), 6 , 2, 1);
display.display();
if(analogRead(0)>765) display.fillRoundRect(4, 30, map(v, 0, 765, 0, 120), 6 , 2, 0);
display.display();
}