loading

Arduino Analog Pin?

Can a arduino analog pin be used as a output pin?

Picture of Arduino Analog Pin?
I think the results should be read through the analog pins.

The output to the LED should be utilizing the digital pin because after some extensive (as well as late-at night) testing I realized Analog pins can NOT handle the 'analogWrite' function. You would need to manually do it so you should stick to utilizing the digital pins.
buteman5 years ago
Yes, it can but not a steady value as such. 

For example:
[code]
int pin = 0 ;//analogue pin 0
int value;

void setup(){} // nothing to do in setup

 void loop()
analogWrite(pin,value)
 }
[/code]
value needs to be between 0 and 255
if value is 0 the output is 0 volts, if value is 255 the output is 5volts.
BUT
if value is between 1 and 254 then the output is a PWM stream.
That is the value varies rapidly between 0 and 5 volts with the output being high and low each of which depends on what 'value' is set to.
If value is 64 then the output will be 5 volts for a quarter of the time and 0 volts for three quarters of the time.
txrx5 years ago
Sure can! see documentation for the digitalWrite() function

http://arduino.cc/en/Reference/digitalWrite According to that doc "The analog input pins can be used as digital pins, referred to as A0, A1, etc."
Bot1398 (author)  txrx5 years ago
But if I want to use it for a sensor application and as a output too for eg i want to make a rgb color sensor and I want the same color sensor to output what it has detected is it possible