So, I am trying to read a piezo knock sensor with:analogRead()
You can read an analog voltage from digital #2 (called A1), digital #3 (called A3) and digital #4 (called A2)
For example, to read an analog voltage on pin #2, you would call analogRead(A1)
Code: Select all
knockSensorVal = analogRead(A1);
I've tried just using '2' (also tried '1' after finding an example on google) to no avail. These compile and load to the trinked, but I am not seeing the behavior I expect...sketch_sep19b.ino: In function 'void loop()':
sketch_sep19b:68: error: 'A1' was not declared in this scope
Here is my loop:
Code: Select all
void loop() {
// Listen for any knock at all.
knockSensorValue = analogRead(A1);
if (knockSensorVal >=threshold){
digitalWrite(redLED,HIGH);
delay(500);
digitalWrite(redLED,LOW);
delay(500);
}
}
Any ideas?