Screaming Monster
Language | English |
---|
目录ObjectiveThis project can detect human movement. When someone passes by, it'll send out monster scream. PrincipleEquipment
Hardware Buildup
Software DebuggingCode Description
#define humanHotSensor 10
#define buttonPin 6
void pirDetector() {
// read the input pin:
humanHotState = digitalRead(humanHotSensor);
// print out the state of the button:
//Serial.println(humanHotState);
delay(1); // delay in between reads for stability
if(humanHotState) {
Serial.println("play sound.....");
audio_choose(1);// 2:health,1:noHealth
audio_play();
}
}
void updateButton() {
if(key_get(buttonPin,0)) {
delay(200);
on_off=!on_off;
}
if(statusChange!=on_off) {
statusChange=on_off;
if(on_off) {
Serial.println("pause");
audio_pause();
}
else {
Serial.println("pause");
audio_pause();
}
}
}
ProgramResultIt can detect human movement. When someone passes by, it'll scream. By touching the button, it will stop screaming. Video |