confused Buzzards Bay STEM teacher: analogRead(A0)
Posted: Wed Jul 26, 2017 5:43 am
Board Setup and under test:
Setup:
very simple script
// Bradshaw Lupton BBSTEMA@piRshared.com
// Buzzards Bay STEM Academy 2017
int counter = 0;
void setup() {
Serial.begin(9600); delay(6000); yield();
Serial.println("adc test");
/* Initialize the ADC pin as an input. */
pinMode(A0, INPUT);
}
void loop() {
Serial.print("Yellow board LDR value = ");
Serial.print(analogRead(A0));
Serial.print(" count=");
Serial.println(counter++);
delay(500);
}
Crummy output, in a dark room, bright LED flashlight,
Expected full range of numbers 0-1023.
Isn't it "always something?", probably good old, "user" error.
adc test (nearly black room, shining bright flashlight on the LDR)
Yellow board LDR value = 3 count=0
Yellow board LDR value = 3 count=1
Yellow board LDR value = 3 count=2
Yellow board LDR value = 3 count=3
Yellow board LDR value = 2 count=4
Yellow board LDR value = 3 count=5
Yellow board LDR value = 3 count=6
Yellow board LDR value = 3 count=7
Yellow board LDR value = 2 count=8
Yellow board LDR value = 9 count=9
Yellow board LDR value = 9 count=10
Yellow board LDR value = 9 count=11
Yellow board LDR value = 9 count=12
Setup:
very simple script
// Bradshaw Lupton BBSTEMA@piRshared.com
// Buzzards Bay STEM Academy 2017
int counter = 0;
void setup() {
Serial.begin(9600); delay(6000); yield();
Serial.println("adc test");
/* Initialize the ADC pin as an input. */
pinMode(A0, INPUT);
}
void loop() {
Serial.print("Yellow board LDR value = ");
Serial.print(analogRead(A0));
Serial.print(" count=");
Serial.println(counter++);
delay(500);
}
Crummy output, in a dark room, bright LED flashlight,
Expected full range of numbers 0-1023.
Isn't it "always something?", probably good old, "user" error.
adc test (nearly black room, shining bright flashlight on the LDR)
Yellow board LDR value = 3 count=0
Yellow board LDR value = 3 count=1
Yellow board LDR value = 3 count=2
Yellow board LDR value = 3 count=3
Yellow board LDR value = 2 count=4
Yellow board LDR value = 3 count=5
Yellow board LDR value = 3 count=6
Yellow board LDR value = 3 count=7
Yellow board LDR value = 2 count=8
Yellow board LDR value = 9 count=9
Yellow board LDR value = 9 count=10
Yellow board LDR value = 9 count=11
Yellow board LDR value = 9 count=12