With the following code I get a log like the one below. Why is that?
int analogPin = 5;
int val = 0;
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
val = analogRead(analogPin);
Serial.print("Analog reading = ");
Serial.println(val);
}
Result:
Analog reading = 998
Analog reading = 981
Analog reading = 511
Analog reading = 159
Analog reading = 24
Analog reading = 108
Analog reading = 439
Analog reading = 946
Analog reading = 1023
Analog reading = 420
Analog reading = 116
Analog reading = 25
Analog reading = 151
Analog reading = 542
Analog reading = 997
Analog reading = 982
Analog reading = 513
Analog reading = 161
Analog reading = 25
Analog reading = 107
Analog reading = 437
Analog reading = 945
Analog reading = 1023
Analog reading = 421
Analog reading = 117
Analog reading = 25
Analog reading = 150
Analog reading = 541
Analog reading = 997
Analog reading = 983
Analog reading = 515
Analog reading = 162
Analog reading = 25
Analog reading = 107
Analog reading = 437
Analog reading = 945
Analog reading = 1023
Analog reading = 422
Analog reading = 117
Analog reading = 25
Analog reading = 149
Analog reading = 540
Analog reading = 997
Analog reading = 983
Analog reading = 516
Analog reading = 162
Analog reading = 25
Analog reading = 107
Analog reading = 436
Analog reading = 945
Analog reading = 1023
Analog reading = 422
Analog reading = 117
Analog reading = 25
Analog reading = 150
Analog reading = 540
Analog reading = 998
Analog reading = 982
Analog reading = 516
Analog reading = 162
Analog reading = 25
Analog reading = 108
Analog reading = 437
Is the result just noise?
And as soon as I plug in a cable I see the following pattern:
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 72
Analog reading = 447
Analog reading = 1023
Analog reading = 1023
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 118
Analog reading = 849
Analog reading = 1023
Analog reading = 835
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 40
Analog reading = 401
Analog reading = 1023
Analog reading = 1023
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 89
Analog reading = 475
Analog reading = 1023
Analog reading = 1023
Is that my heartbeat or so??? No idea what can have such an influence on a empty pin.
No comments:
Post a Comment