Closed joeltbennett closed 4 years ago
After reading this thread, I moved the hall sensor read pin from 2 to 36 and it's perfect now. It works after an update and there's much less EM interference too. I suppose this can be closed, sorry to annoy.
edit: the conclusion is that there's some analog pins that don't read well when WiFi is being used, so the WiFi update feature was probably not shutting off properly when there was a restart or something.
@joeltbennett All pins on ADC2 (those less than 30) will not be usable for analogRead() when WiFi is active. Bluetooth is also a problem in the current releases but there are changes coming in a future release which will change this.
Didn't realize this is a known thing...I'll have to google harder next time :|
What you are trying to do?
Read a hall sensor using 3.3v / ground / IO2 pins after restarting the board programmatically.
Describe your system( Hardware, computer, O/S, core version, environment).
The board is Wemos D1 R32, just an Arduino-type shield. I'm using the Arduino IDE for programming. The board is connected to a Nextion screen that controls all of the functions - most of the pins on the ESP32 board are being utilized by various components. Only one analog pin is being used -- GPIO 2 reads the signal from an SS49E hall sensor.
Describe what is failing.
The hall sensor works fine after the board has been turned off and on manually. When the board is flashed (HTTP connection sending over a compiled bin), a restart is triggered (ESP.restart) - when I navigate back to the hall sensor reading page on the Nextion, the signal is just reading as a single number. If the hall sensor is unplugged, the signal reading does not change.
Show the shortest possible code that will duplicate the error.