Pt-7: How To Program the Knock Sensor Module from the 37 in 1 Sensor Kit #arduino #knocksensor

preview_player
Показать описание
How to program the Knock Sensor Module from the KEYESTUDIO 37 in 1 Sensor Kit using the Arduino UNO, Arduino IDE. The diagram was made using Fritzing. #arduino #arduinouno #37in1sensorskit #keyestudio #knocksensor #vibrationsensor #vibration

Here's the Arduino code:
FYI, for future reference, YT doesn't like angle brackets (aka 'less than' or 'greater than' symbols). If you see code with 'lt/lte' and 'gt/gte' below then substitute with the 'less than/less than equal to' and 'greater than/ greater than equal to' symbols.
***************************************
int knockSensorModule = 8;
bool readingKnockSensor = 0;
int rgbLEDModule = 12;

void setup() {
pinMode(knockSensorModule, INPUT);
pinMode(rgbLEDModule, OUTPUT);
}

void loop() {
readingKnockSensor = digitalRead(knockSensorModule);

if (readingKnockSensor == LOW) {
for (int x=0; x 'lt' 3; x++){
digitalWrite(rgbLEDModule, HIGH);
delay(1000);
digitalWrite(rgbLEDModule, LOW);
delay(1000);
}
}
else {
digitalWrite(rgbLEDModule, LOW);
}
delay(10);
}
***************************************
Рекомендации по теме
Комментарии
Автор

Thank you so much, big explanation;
I'm so appreciative to you also for adding English subtitles with video for non native speaker like us :)

bstanis
join shbcf.ru