Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: None of the Analog Read Examples are working with 2560 on: October 01, 2012, 02:41:19 pm
You need to tell us exactly what you wired up, and how you wired it.

Code:
/*
  ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 
 This example code is in the public domain.
 */

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
}

Following this image:
Using 110k potentiometer. But the serial always showed 1023, even using the potentiometer at the mimimum.

Also tried this example: http://arduino.cc/en/Tutorial/AnalogInOutSerial , but the potentiometer didn't changed led.

And i used other potentiometer but also, no sucess..
17  Using Arduino / Programming Questions / None of the Analog Read Examples are working with 2560 on: October 01, 2012, 01:53:18 pm
I tried all the examples (the basic examples ) using analog input with potentiometer, even changed to a resistor but none of them worked, the serial monitor always show 1023, and in other examples using leds, the potentiometer doesn't change led brightness. Sorry for my bad english.
Pages: 1 [2]