Serial Monitor

ey!

I am trying to use Serial Monitor to see the values that a photoresistor delivers to arduino, and I really dont understand why, I cannot handle it.

int sensorValue;

void setup() {
    sensorValue = analogRead(A0);
}

void loop() {
  sensorValue = analogRead(A0);

  Serial.begin(9600);
  Serial.println(sensorValue);
}

Attached as well. what am I doing wrong?

simple.ino (174 Bytes)

What do you mean "cannot handle it"?

void setup() {
Serial.begin(115200);
sensorValue = analogRead(A0);
}

thanks but still...

this is what serial monitor shows me now

?$?Ê?þ

Even with the Serial.begin in setup()?

You should have Serial.begin(9600); in setup(), not in loop().

You also need to have the same baud rate selected in the serial monitor as in the Arduino sketch - for example both at 9600 baud or both at 115200 baud.

...R

ok

this is my code now, and it is working

int sensorValue;

void setup() {
  Serial.begin(9600);
  sensorValue = analogRead(A0);
}

void loop() {
  Serial.println(sensorValue);
}

but I receive the same value (1008)
something else is also wrong... have to check

You're only reading the input once - it isn't surprising the value doesn't change

well, can you provide me with the way to monitor this value continuosly?

If loop runs forever, what do you think will happen?

Move something out of setup and put it into loop. :wink:

:slight_smile: