Hello Random Nerds. I have a problem with getting an output on 2 ESP32s (ESP32 WROOM 32). I wrote a code using TouchPad as the INPUT and the OUTPUT turning on a LED. The code and circuit worked as expected on esp32#1. Trying the exact same code & circuit on 2 more ESP32s did not work. The input worked as expected but there was no OUTPUT…..the LED did not turn on. All 3 ESP32s were flashed with the exact same firmware. The Blink.py code worked on all 3 as well. On the 2 I’m having issues with I even tried a different GPIO for the OUTPUT but still got the same results. Can someone please point me in the right direction to resolve this issue? The code I used is below. Please keep in mind that the exact same code & circuit worked as expected on ESP32#1 but did not work on ESP32 #2 & #3. Thanks in advance.
from machine import Pin, TouchPad
from time import sleep
touch_pin = TouchPad(Pin(4))
led = Pin(15, Pin.OUT)
while True:
touch_value = touch_pin.read()
print(touch_value)
if touch_value < 500:
led.value(1)
else:
led.value(0)
sleep(0.5)
Hi.
have you tried changing the GPIOs both of them?
Can you share a link to the boards that you have?
Regards.
Sara
Hello Sara. I truly do appreciate you getting back with me, and as quickly as you did. That was awesome. Thanks again. I found the problem. I neglected the GNDs on boards #2 and #3. I kept seeing the GND from board #1 connected to the breadboard and didn’t realize I did not have the GNDs from boards 2 & 3 connected to the breadboard. While I have your attention perhaps you can help me with my new issue. Using the same code & circuit, everything works while connected to my PC using the Thonny IDE. I have my touch code along with ‘boot.py’ uploaded to all 3 boards. I did not press the reset button before disconnecting from my PC. Using an expansion board with a 9 volt battery I could not get the touch code to run on neither of the 3 boards. What could I be doing wrong?
Hi.
You need to upload the code you want to run on the board automatically with the name “main.py”.
When the ESP32 boots it automatically runs the main.py file.
Let me know if this solves your issue.
Regards,
Sara
Aaaaahhh🤔 It was previously said to use ‘main.py’ or it would not work. I thought it was just for that particular lesson. Is it safe to assume that that is the case across all versions of ESP32s? Is there no way to change that? If I have 5 boards running 5 different codes they would all be named ‘main.py’? So I will have to come up with a way to know which code is on each individual board.