# A0 to Digital Input

**URL:** <https://community.particle.io/t/a0-to-digital-input/17396>\
**Category:** Tutorials\
**Created:** [November 12, 2015, 11:15pm UTC](https://community.particle.io/t/a0-to-digital-input/17396 "2015-11-12T23:15:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [November 12, 2015, 11:15pm UTC](https://community.particle.io/t/a0-to-digital-input/17396/1 "2015-11-12T23:15:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [November 12, 2015, 11:31pm UTC](https://community.particle.io/t/a0-to-digital-input/17396/2 "2015-11-12T23:31:05Z")

</div>

If you check the bit over here, you should be able to find out 🙂  
[https://docs.particle.io/datasheets/photon-datasheet/#pin-markings](https://docs.particle.io/datasheets/photon-datasheet/#pin-markings)

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 13, 2015, 1:13am UTC](https://community.particle.io/t/a0-to-digital-input/17396/3 "2015-11-13T01:13:37Z")

</div>

I just added an explicit note about this in the docs  
[https://docs.particle.io/reference/firmware/photon/#digitalread-](https://docs.particle.io/reference/firmware/photon/#digitalread-)

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [November 13, 2015, 1:29am UTC](https://community.particle.io/t/a0-to-digital-input/17396/4 "2015-11-13T01:29:43Z")

</div>

Thank You, Im still trying to figure it out, but no luck yet. I tried this and nothing.

```auto
void setup()
{
    Serial.begin(9600);

    pinMode (A0, INPUT); 
} 

int DIGITAL;

void loop()
{

	 DIGITAL = digitalRead(A0);
	 Serial.print(DIGITAL);
	 delay(500); 

}

```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 13, 2015, 1:35am UTC](https://community.particle.io/t/a0-to-digital-input/17396/5 "2015-11-13T01:35:23Z")

</div>

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

```cpp
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).

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [November 13, 2015, 1:41am UTC](https://community.particle.io/t/a0-to-digital-input/17396/6 "2015-11-13T01:41:12Z")

</div>

When I do that, I get a reading of 1 all the times. Nothing with 0 reading. I have connected pin A0 to Ground.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 13, 2015, 1:42am UTC](https://community.particle.io/t/a0-to-digital-input/17396/7 "2015-11-13T01:42:26Z")

</div>

Then try another pin, you might have fried your pin on some occasion.

Or double check your wiring.

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [November 13, 2015, 1:43am UTC](https://community.particle.io/t/a0-to-digital-input/17396/8 "2015-11-13T01:43:16Z")

</div>

I tried pin A1 the same. let me try A2 or A3. I’ll let you know.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [November 13, 2015, 1:46am UTC](https://community.particle.io/t/a0-to-digital-input/17396/9 "2015-11-13T01:46:04Z")

</div>

Can you post a pic where we can see the wiring?

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [November 13, 2015, 1:48am UTC](https://community.particle.io/t/a0-to-digital-input/17396/10 "2015-11-13T01:48:53Z")

</div>

@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!
