Problem with analogRead()

Hi!

I'm trying to read an analog value from my photocell, but simply I can't compile my program, because I can't set the input pin to A0 (or A-whatever). My loop():

void loop()
{
  int sensor = analogRead(A0);
  Serial.println(sensor);
}

But I get the following error: "'A0' was not declared in this scope.

Could somebody help? Thanks.
And sorry for my n00b question, I'm just a beginner.

Upgrade to Arduino IDE 0022.

Thanks, it really runs. But unfortunately, I have another problem with the new version (022) of IDE, very often I can't get my program into the arduino (because of "programmer is not responding"), while in the old version (018) it's okay.

you must wait a little bit

Then use, int sensor = analogRead(0); instead. A0 is just an alias of 0, A1 =1, etc.

Lefty

Okay, thanks for replies :slight_smile:

A0 is just an alias of 0,

Close, but A0 has the value 14 (or 54)

Close, but A0 has the value 14 (or 54)

OK, but then analogRead(0) must be an alias of analogRead(14) ?

Lefty

OK, but then analogRead(0) must be an alias of analogRead(14) ?

Exactly.