I have a teensy++ 2.0 and I tried the code given in one of the tutorial :
void setup()
{
Serial.begin(38400);
}
int val;
void loop()
{
val = analogRead(0);
Serial.print("analog 0 is: ");
Serial.println(val);
delay(250);
}
It's said in the tutorial that the value should be 0 when is at 0 volts.
However, when nothing is connected to the pin (and the other pins) I get something like this :
analog 0 is: 386
analog 0 is: 373
analog 0 is: 374
analog 0 is: 368
analog 0 is: 380
analog 0 is: 378
analog 0 is: 376
analog 0 is: 368
analog 0 is: 345
analog 0 is: 342
analog 0 is: 365
analog 0 is: 359
....
Do you have any idea of where the problem might come from ?
Thanks in advance.
void setup()
{
Serial.begin(38400);
}
int val;
void loop()
{
val = analogRead(0);
Serial.print("analog 0 is: ");
Serial.println(val);
delay(250);
}
It's said in the tutorial that the value should be 0 when is at 0 volts.
However, when nothing is connected to the pin (and the other pins) I get something like this :
analog 0 is: 386
analog 0 is: 373
analog 0 is: 374
analog 0 is: 368
analog 0 is: 380
analog 0 is: 378
analog 0 is: 376
analog 0 is: 368
analog 0 is: 345
analog 0 is: 342
analog 0 is: 365
analog 0 is: 359
....
Do you have any idea of where the problem might come from ?
Thanks in advance.