Hello everyone
I'm currently trying out the LILYGO T-Display ESP32
I wrote a short test program and checked the two integrated buttons on GPIO 0 and GPIO 35.
The GPIO 0 button is supposed to increment a variable and GPIO 35 is supposed to decrement it.
GPIO 0 does what it's supposed to but GPIO 35 counts down several times between 4 and 10.
What am I doing wrong? Or is there a software error?
Here is the program
-------------------------------------------------------------
pin.mode 0, input,pullup
pin.mode 35, input,pullup
a=12345
interrupt 0, go0,1
interrupt 35, go35,1
TFT.FILL 0
TFT.BRIGHTNESS 255
'TFT.IMAGE"/123.bmp"
pause 2000
TFT.RECT 0,0,240,135, TFT.RGB(50, 50, 250),1
TFT.RECT 10, 40,220,70, TFT.RGB(150, 150, 250),1,5
tft.text.color TFT.RGB(250, 2, 2)
TFT.TEXT.DRAW str$(a),120,50,7
tft.text.color 0
TFT.TEXT.DRAW "Starten",120,5,4
wait
go0:
wlog "pin 0"
a=a+1
TFT.RECT 10, 40,220,70, TFT.RGB(150, 150, 250),1,5
tft.text.color TFT.RGB(2, 2, 2)
TFT.TEXT.DRAW str$(a),120,50,7
pause 100
return
go35:
wlog "pin35"
a=a-1
TFT.RECT 10, 40,220,70, TFT.RGB(150, 150, 250),1,5
tft.text.color TFT.RGB(2, 2, 2)
TFT.TEXT.DRAW str$(a),120,50,7
pause 100
return
---------------------------------------------------------------
Kind regards
Waldemar
Strange behavior LILYGO T-Display ESP32
Re: Strange behavior LILYGO T-Display ESP32
Here is the module
You do not have the required permissions to view the files attached to this post.
- cicciocb
- Site Admin
- Posts: 2781
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 592 times
- Been thanked: 1990 times
- Contact:
Re: Strange behavior LILYGO T-Display ESP32
You have probably bounces on the pin. Try to put a capacitor on the pin
- PeterN
- Posts: 641
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 296 times
- Been thanked: 357 times
- Contact:
Re: Strange behavior LILYGO T-Display ESP32
I think this GPIO doesn‘t have a pullup resistor to be activated.
I would try an external 10K to pullup the pin to 3V3
https://www.perplexity.ai/search/which- ... 65sluawWow
I would try an external 10K to pullup the pin to 3V3
https://www.perplexity.ai/search/which- ... 65sluawWow
Re: Strange behavior LILYGO T-Display ESP32
Hello,
I debounced the button with a 22nF capacitor.
The behavior remained the same. After each key press,
the count went down by exactly 10 too many.
Regards
Waldemar
I debounced the button with a 22nF capacitor.
The behavior remained the same. After each key press,
the count went down by exactly 10 too many.
Regards
Waldemar
Re: Strange behavior LILYGO T-Display ESP32
Hello,
I just read your last posting
I'm trying with a pull-up resistor.
Regards
Waldemar
I just read your last posting
I'm trying with a pull-up resistor.
Regards
Waldemar
Re: Strange behavior LILYGO T-Display ESP32
Hello,
Thanks Peter,
the information that the GPIO35 has no pull-up and pull-down resistors
was correct. With a 4k7 resistor everything works as planned.
Regards
Waldemar
Thanks Peter,
the information that the GPIO35 has no pull-up and pull-down resistors
was correct. With a 4k7 resistor everything works as planned.
Regards
Waldemar
- PeterN
- Posts: 641
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 296 times
- Been thanked: 357 times
- Contact:
Re: Strange behavior LILYGO T-Display ESP32
Hi Waldemar,
prima, dass es nun grundsätzlich klappt!
Francesco hat aber auch recht mit seinem Hinweis auf das Prellen.
Ich würde in der Interruptroutine noch zu Beginn 100ms warten und nur weitermachen, wenn der Pin danach noch heruntergezogen ist. Sonst RETURN
great that it's basically working now!
Francesco is also right with his reference to bouncing.
I would wait 100ms in the interrupt routine at the beginning and only continue if the pin is still pulled down afterwards. Otherwise RETURN
prima, dass es nun grundsätzlich klappt!
Francesco hat aber auch recht mit seinem Hinweis auf das Prellen.
Ich würde in der Interruptroutine noch zu Beginn 100ms warten und nur weitermachen, wenn der Pin danach noch heruntergezogen ist. Sonst RETURN
great that it's basically working now!
Francesco is also right with his reference to bouncing.
I would wait 100ms in the interrupt routine at the beginning and only continue if the pin is still pulled down afterwards. Otherwise RETURN