Doesn’t matter if I am using Tinker or my own software, everything I try with AnalogRead does not seem to work (A0, A1, A2, A3, A4, A5. Tried several Photons with firmware 0.4.6. I have also tried INPUT, INPUT_PULLUP, INPUT_PULLDOWN). I get one good (above 2000) reading and then everything is around 320, which I assume is just noise.
I have tried lots of different arrangements from voltage dividers, to direct 3V3 connections. I am sure these things worked fine a few weeks ago. Am I doing something wrong (highly likely), or does 0.4.6 have a strange bug that effects the analogRead?
It’s not impossible that there’s a bug. To my knowledge, no changes happened in the GPIO code, yet I’m seeing reports of DAC pins working differently with analogWrite, so potentially analogRead is affected too.
One way to know for sure is to downgrade your firmware by downloading from github releases and flashing with particle CLI.
Then recompile your app in the WebIDE against 0.4.5 and see if the behavior is still the same.
Although that sounds like a lot of fun , perhaps someone else with a 0.4.6 firmware photon could just check analogRead at A0 or A1 and see if it is working fine for them (even low-0 and high-4096 is better than I am getting). If it works fine for them, then I have screwed up, if not then I can stop bashing my head against the computer screen and wait for an upgrade.
@rocksetta I have an application on Photon with firmware 0.4.6 which does analogRead at A0, A1 & A2. All three pins are connected to soil moisture sensors. I have not seen any problems with the analogRead so far.
Have you checked your supply?
Noisy DC has been causing multiple troubles for other members.
You could try direcly off a USB port if your circuitry doesn’t need more than 500mA otherwise try a well filtered USB supply or - even better - a lab bench supply.
One of my students found out that the Tinker on the cloud main IDE page has the problem. As soon as I flash tinker from the Particle App then AnalogRead A0 works. Perhaps the Tinker that is set for the main cloud IDE page could be updated.