ESP32-MiniWebRadio icon indicating copy to clipboard operation
ESP32-MiniWebRadio copied to clipboard

Taster einbinden

Open fv1895 opened this issue 1 year ago • 3 comments

Hallo zusammen,

ich würde gerne 3 Taster in das Programm integrieren, scheitere aber kläglich:

  1. nextstation
  2. prevstation
  3. mute

Bei meinem Versuche ist der Taster quasi immer gedrückt, was mache ich falsch?

Ich habe es wie folgt versucht: `void setup() { Serial.begin(115200); Serial.print("\n\n");

pinMode(35, INPUT_PULLUP);`

`void loop() { if(!_f_ESPfound) return; // Guard: wrong chip? if(!_f_SD_MMCfound) return; // Guard: SD_MMC could not be initialisized webSrv.loop(); ir.loop(); tp.loop(); ftpSrv.handleFTP(); soap.loop();

if (digitalRead(35) == HIGH) { SerialPrintfln ("Taster ein"); }`

Ich würde mich sehr über eine Lösung freuen! Schönen Gruß

Marcus

fv1895 avatar Dec 15 '23 10:12 fv1895

Hallo Marcus, mechanische Tasten neigen zum Prellen. Daher ist es besser eine Wartezeit einzubauen. Bsp. (nicht getestet, wird aber funktionieren)

void loop(){
...
    static bool bt = false;
    static uint32_t ms = 0;
    if(digitalRead(35) == LOW && bt == false){
        bt = true;
        nextStation();
        ms = millis() + 200; // wait 200ms
    }
   if(bt == true && ms < millis()) bt = false;
....
}
````
Der ESP32 hat an PINs 34...39 keine internen PullUps,  du müsstest dann einen von außen (~1...50K) anbauen




schreibfaul1 avatar Dec 15 '23 12:12 schreibfaul1

Vielen Dank! Ich werde es ausprobieren.

Super es funktioniert!!! Besten Dank :)

fv1895 avatar Dec 15 '23 13:12 fv1895

Passt jetzt nicht zu dem Thema aber jetzt ist ein weiteres Problem aufgetaucht, der Touchscreen reagiert nicht richtig. Ich bekomme immer folgende Fehlermeldung: Touchpoint not valid

Am TFT liegt es nicht, habe das selbe Problem auch auf einem neuen Display. Woran kann das liegen?

fv1895 avatar Dec 18 '23 12:12 fv1895

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Feb 15 '25 02:02 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Mar 01 '25 02:03 github-actions[bot]