Problem with sensing in Project 4

Hi,
I am having a problem with project four. For some reason the sensors doesn't work and continiously show value 0. i checked manualy and the serial connection is established and the led shows different colours, if i manually preset them.

My code is:

const int greenLEDpin=9;
const int redLEDpin=10;
const int blueLEDpin=11;

const int redSensorPin=A0;
const int greenSensorPin=A1;
const int blueSensorPin=A2;

int redValue=0;
int blueValue=0;
int greenValue=0;

int redSensorValue=0;
int greenSensorValue=0;
int blueSensorValue=0;

void setup(){
Serial.begin(9600);
pinMode(greenLEDpin, OUTPUT);
pinMode(redLEDpin, OUTPUT);
pinMode(blueLEDpin, OUTPUT);
}

void loop(){

redSensorValue = analogRead(A0);
delay(5);
greenSensorValue = analogRead(greenSensorPin);
delay(5);
blueSensorValue=analogRead(blueSensorPin);

Serial.print("Raw sensor values \t Red: ");
Serial.println(redSensorValue);
Serial.print("\t Green: ");
Serial.println(greenSensorValue);
Serial.print("\t Blue: ");
Serial.println(blueSensorValue);

redValue=redSensorValue/4;
greenValue=greenSensorValue/4;
blueValue=blueSensorValue/4;

Serial.print("Mapped sensor values \t Red: ");
Serial.println(redValue);
Serial.print("Green: ");
Serial.println(greenValue);
Serial.print("Blue: ");
Serial.println(blueValue);

analogWrite(redLEDpin, redValue);
analogWrite(blueLEDpin, blueValue);
analogWrite(greenLEDpin, greenValue);

}

I noticed also that if I unplug cables from a0 and a1, the led goes red and blue, respectively. but if i unplug the a2, nothing happens.

I would be greatful for help. I must be not seeing some simple error.

I don't have the beginners kit, but working with several Arduino boards.

Suggestions:

What do you have at the inputs to the analog pins ?
If the voltage level is static, you won't have any change visible until you apply a varying voltage manually.

Again a guess from me, but when you unplug A0 and A1 you are changing the chip I/O pin state manually so you see an indication.
Also, you seem to have a wiring issue: should not A1 signal a "green" input state ?

I believe you don't have a programming error, you are simply not interpreting the purpose of the project correctly

Hey,

Thank you for the advices. I found out the problem. I looked at the board today during the day and i saw one of the cables was plugged in wrong. i did not see it last time in the book in the picture as it was evening and i did not spot it. i knew it is something silly. thanks again.

The breadboard diagrams are quite tricky to read, especially in the evening when most of us probably do this stuff. Maybe a clearer solid black mark on which hole each thing was in, or x,y coordinates, would help