PWI input
Posted: Sat Sep 17, 2016 1:25 pm
I'm wondering about the PWI option in the IO() function. What is it supposed to do? As I experimented, I found that grounding the pin gives me a 0 and raising it returns a 1023.
So I looked at source code and it appears that when you do an IO(PWI,pin) function, this does an analogRead() of a digital pin. It appears that the arduino implementation of analogRead() does not allow this but perhaps it provides a simulation by returning numbers in the range that the ADC would, just full low or full high.
My guess is that the analogRead() was used in ESPbasic code as a place holder until something like a pulse width detector could be implemented. Could this be? Is it likely to happen? Is there any other magic that I might be missing?
So I looked at source code and it appears that when you do an IO(PWI,pin) function, this does an analogRead() of a digital pin. It appears that the arduino implementation of analogRead() does not allow this but perhaps it provides a simulation by returning numbers in the range that the ADC would, just full low or full high.
My guess is that the analogRead() was used in ESPbasic code as a place holder until something like a pulse width detector could be implemented. Could this be? Is it likely to happen? Is there any other magic that I might be missing?