Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int knockSensor = A0;
- const int threshold = 100;
- void setup() {
- pinMode(knockSensor, INPUT);
- Serial.begin(9600);
- }
- void loop() {
- if(analogRead(knockSensor) >= threshold)
- Serial.println("Knock!");
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement