Hello, Can some show me. If is posible? I want to make A0 Input to A0 digital Input. I want to use it to monitor an ON OFF switch. 1 or 0
Thank You
If you check the bit over here, you should be able to find out
https://docs.particle.io/datasheets/photon-datasheet/#pin-markings
I just added an explicit note about this in the docs
https://docs.particle.io/reference/firmware/photon/#digitalread-
Thank You, Im still trying to figure it out, but no luck yet. I tried this and nothing.
void setup()
{
Serial.begin(9600);
pinMode (A0, INPUT);
}
int DIGITAL;
void loop()
{
DIGITAL = digitalRead(A0);
Serial.print(DIGITAL);
delay(500);
}
What do you mean with nothing - when I try this it just does what I’d expect:
When connecting A0 to GND I see 0
and when connecting to 3V3 I see 1
what else do you expect?
You could try without serial output like this
void setup()
{
pinMode (D7, OUTPUT);
pinMode (A0, INPUT);
}
void loop()
{
digitalWrite(D7, digitalRead(A0));
}
But if you are using a button you should use INPUT_PULLUP
or INPUT_PULLDOWN
instead of INPUT
.
With my code you’ll notice, that the blue LED is a bit dimmer when A0 is not connected to anything than when A0 is pulled high. This comes from the fact, that a floating pin has no defined state and can report HIGH or LOW unpredictably and also very rapidly changing (hence the dimness).
When I do that, I get a reading of 1 all the times. Nothing with 0 reading. I have connected pin A0 to Ground.
Then try another pin, you might have fried your pin on some occasion.
Or double check your wiring.
I tried pin A1 the same. let me try A2 or A3. I’ll let you know.
Can you post a pic where we can see the wiring?
@ScruffR I got it working… I guess I fried A0 and A1 )- I’m using A2 and is working perfect.
THANK You for your help!