Life_Game — ESP32 simulation

An interactive ESP32 circuit simulation you can run free in your browser on Velxio, by edelarosagon.

Components

Sketch code

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define ANCHO 128
#define ALTO 64

#define OLED_RESET -1
#define OLED_ADDR 0x3C

Adafruit_SSD1306 display(ANCHO, ALTO, &Wire, OLED_RESET);

void setup() {
  Serial.begin(115200);

  // Inicializar I2C del ESP32
  Wire.begin(21, 22);

  // Inicializar pantalla
  if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) {
    Serial.println("No se encontro la pantalla OLED");
    while (true);
  }

  // Limpiar pantalla
  display.clearDisplay();
  display.display();

  Serial.println("=================================");
  Serial.println(" DEMOSTRACION DE PANTALLA OLED");
  Serial.println("=================================");

  delay(1000);
}

void loop() {

  // -------------------------------------------------
  // 1. TEXTO
  // -------------------------------------------------
  mostrarTexto();
  delay(2500);

  // -------------------------------------------------
  // 2. DIFERENTES TAMANOS DE TEXTO
  // -------------------------------------------------
  tamanosTexto();
  delay(2500);

  // -------------------------------------------------
  // 3. LINEAS
  // -------------------------------------------------
  dibujarLineas();
  delay(2500);

  // -------------------------------------------------
  // 4. RECTANGULOS
  // -------------------------------------------------
  dibujarRectangulos();
  delay(2500);

  // -------------------------------------------------
  // 5. CIRCULOS
  // -------------------------------------------------
  dibujarCirculos();
  delay(2500);

  // -------------------------------------------------
  // 6. PIXELES
  // -------------------------------------------------
  dibujarPixeles();
  delay(2500);

  // -------------------------------------------------
  // 7. TEXTO INVERTIDO
  // -------------------------------------------------
  textoInvertido();
  delay(2500);

  // -------------------------------------------------
  // 8. BARRA DE PROGRESO
  // -------------------------------------------------
  barraProgreso();

  // -------------------------------------------------
  // 9. ANIMACION
  // -------------------------------------------------
  animacion();

  // Repetir demostracion
}


// =====================================================
// FUNCION 1: MOSTRAR TEXTO
// =====================================================

void mostrarTexto() {

  display.clearDisplay();

  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);

  display.println("ESP32 + OLED");
  display.println("----------------");
  display.println();
  display.println("Demostracion");
  display.println("de funciones");
  display.println();
  display.println("Pantalla:");
  display.println("SSD1306 128x64");

  display.display();
}


// =====================================================
// FUNCION 2: DIFERENTES TAMANOS DE TEXTO
// =====================================================

void tamanosTexto() {

  display.clearDisplay(

More projects by edelarosagon