#include "Arduino.h"
#include <Adafruit_NeoPixel.h>
#include <Adafruit_SSD1306.h>
#include "BFKMiMonDefines.h"
#include "BFKMiMonOLED.h"
#include "BFKMiMonConfig.h"
#include <Wire.h>
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// DOESN'T WORK :(
#define LED 46
#define PIN_NEO 4
#define NUMPIXELS 2
#define BOTON 0
MiMonConfig Cfg;
MiMonOLED OLED(&display, &Cfg);
Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEO, NEO_GRB + NEO_KHZ800);
byte btn;
byte lastBtn;
void setup() {
Serial.begin(115200);
Serial.println("Hello, ESP32-S3!");
pinMode(LED, OUTPUT);
pinMode(BOTON, INPUT_PULLUP);
lastBtn = 0;
pixels.begin();
pixels.clear();
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
display.clearDisplay();
display.setTextSize(SCREEN_TEXT_SIZE);
display.setTextColor(SSD1306_WHITE);
OLED.Repaint();
Serial.println("Repintado OLED");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
digitalWrite(LED, HIGH);
pixels.setPixelColor(0, 0x00ff00);
pixels.show();
delay(500);
digitalWrite(LED, LOW);
pixels.setPixelColor(0, 0xff0000);
pixels.show();
delay(500);
byte btn = digitalRead(BOTON);
if(lastBtn != btn)
{
Cfg.MIDIInToOut.Set(!Cfg.MIDIInToOut.Get());
OLED.Repaint();
lastBtn = btn;
Serial.println("Botón cambia");
}
}