Chat freely about anything...

User avatar
By Zim
#79807 Peer to Peer is working fine, but when I attempt to "analogRead" the analog pin on the station, the station stops receiving. It doesn't hang, it just stops receiving until a reflash without "digitalread".
Any Ideas?
Thanks
Last edited by Zim on Wed Jan 02, 2019 1:20 pm, edited 1 time in total.
User avatar
By rudy
#79808 I didn't think that you could do a digital read of A0 on the ESP8266. It is only an analog input.

https://arduino-esp8266.readthedocs.io/ ... alog-input

ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC).

To read external voltage applied to ADC pin, use analogRead(A0). Input voltage range of bare ESP8266 is 0 — 1.0V, however some many boards may implement voltage dividers. To be on the safe side, <1.0V can be tested. If e.g. 0.5V delivers values around ~512, then maximum voltage is very likely to be 1.0V and 3.3V may harm the ESP8266. However values around ~150 indicates that the maximum voltage is likely to be 3.3V.

To read VCC voltage, use ESP.getVcc() and ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:

Code: Select allADC_MODE(ADC_VCC);


This line has to appear outside of any functions, for instance right after the #include lines of your sketch.



Image
User avatar
By Zim
#79809 sorry, my mistake....I meant to write "analogRead".
The problem exists once analogRead is invoked. No receiving messages....
User avatar
By leenowell
#79924 I had a similar issue where my espNow receiver was rock solid and then suddenly after flashing an update stopped working. After much head scratching I did the following 2 things and it fixed the problem - sorry don't know which was the root cause as I did both together
1. I had the crystal frequency setting at 40 instead of 26. I had this on 2 esps and this caused all sorts of weird behaviour
2. A schoolboy error.... I was sending a string so on the send used strlen (s) as the size of the data instead of strlen(s) + 1 !!!