Screaming Monster
From Microduino Wiki
Revision as of 07:21, 30 October 2015 by 1304410487@qq.com (talk) (Created page with "{{Language| Screaming Monster }} {| style="width: 800px;" |- | ==Objective== This project can detect human movement. When someone passes by, it'll send out monster scream. ...")
Language: | English • 中文 |
---|
ContentsObjectiveThis 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 |