@flypeek this code, Atom g21 and g25 connected to the scroll grove port and library original pin assigment, works!!!
#include <M5Atom.h>
#include <M5UnitScroll.h>
M5UnitScroll unitScroll;
void setup() {
M5.begin();
Serial.begin(115200);
if (!unitScroll.begin()) {
// if (!unitScroll.begin(&Wire, 0x40, 26, 32, 400000U)) {
// if (!unitScroll.begin(&Wire, 0x40, 32, 26, 400000U)) {
Serial.println("Errore nell'inizializzazione del sensore");
while (1); // Ferma il programma in caso di errore
}
// LED
unitScroll.setLEDColor(0x0000FF);
}
void loop() {
int32_t encoderValue = unitScroll.getEncoderValue();
Serial.print("Valore encoder: ");
Serial.println(encoderValue);
if (unitScroll.getButtonStatus()) {
Serial.println("Pulsante premuto!");
unitScroll.setLEDColor(0xFF0000); // Rosso
delay(500);
unitScroll.setLEDColor(0x00FF00); // Verde
delay(500);
}
delay(100);
}
but I need to connect the unit to the Atom grove port.... some tips??