Esp32 écran tactile, allumage du fond d'écran

De Wiki de Mémoire Vive
Aller à la navigation Aller à la recherche

Ce code fait clignoter le fond d'écran de l'écran tactile.

// GPIO safe pour sorties LED (sans GPIO 4, 16, 17)
const int ledPins[] = {27};
const int numPins = sizeof(ledPins) / sizeof(ledPins[0]);

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("=== Test automatique GPIO pour fond d'écran ===");

  // configurer toutes les GPIO comme sorties
  for (int i = 0; i < numPins; i++) {
    pinMode(ledPins[i], OUTPUT);
    digitalWrite(ledPins[i], LOW);
  }
}

void loop() {
  for (int i = 0; i < numPins; i++) {
    Serial.print("Test GPIO ");
    Serial.println(ledPins[i]);

    digitalWrite(ledPins[i], HIGH); // allumer (essai)
    delay(2000);                     // observer si le fond d'écran réagit
    digitalWrite(ledPins[i], LOW);  // éteindre
    delay(400);
  }
}