#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C // I2C address 0x3D or 0x3C
Adafruit_SSD1306 oledcito(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
LiquidCrystal_I2C lcd_verde(0x27, 16, 2);
unsigned int potenciometro1 = 0;
unsigned int potenciometro2 = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32-S3!");
lcd_verde.init();
lcd_verde.backlight();
lcd_verde.setCursor(0,0);
lcd_verde.print("Hola upcino!");
delay(3000);
lcd_verde.clear();
//inicializacion del oledcito
if(!oledcito.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
oledcito.display(); //mandamos comando al display
delay(1000);
oledcito.clearDisplay();
oledcito.setTextSize(3);
oledcito.setTextColor(SSD1306_WHITE);
oledcito.setCursor(0,0);
oledcito.println(F("Summer"));
oledcito.display();
oledcito.setTextSize(2);
oledcito.setTextColor(SSD1306_WHITE);
oledcito.setCursor(30,30);
oledcito.println(F("time"));
oledcito.display();
}
void loop() {
// put your main code here, to run repeatedly:
potenciometro1 = analogRead(1);
potenciometro2 = analogRead(2);
lcd_verde.setCursor(0,0);
lcd_verde.print("ADC 1:");
lcd_verde.print(map(potenciometro1, 0, 4095, 0, 15));
lcd_verde.print(" ");
lcd_verde.setCursor(0,1);
lcd_verde.print("ADC 2:");
lcd_verde.print(map(potenciometro2, 0, 4095, 0, 100));
lcd_verde.print(" ");
delay(10); // this speeds up the simulation
}