Analog input Analog output of arduino
analogWrite() Arduino uno has 8 bit DAC Actually analog output of Arduino is PWM. On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11. Syntax analogWrite(pin, value) Example Code Sets the output to the LED proportional to the value read from the potentiometer.(Note:-make correction analog pin=A3 ). int ledPin = 9 ; // LED connected to digital pin 9 int analogPin = 3 ; // potentiometer connected to analog pin 3 int val = 0 ; // variable to store the read value void setup () { pinMode (ledPin, OUTPUT ); // sets the pin as output } void loop () { val = analogRead (analogPin); // read the input pin analogWrite (ledPin, val / 4 ); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 } ...