“Screaming Monster”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
(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. ...")
 
(没有差异)

2015年10月30日 (五) 07:21的最新版本

Language English

Objective

This project can detect human movement. When someone passes by, it'll send out monster scream.

Principle

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pin board
Microduino-TOUCH 1 Touch sensor
Microduino-PIR 1 Infrared pyroelectric sensor
Microduino-Audio 1 Audio module
Microduino-Amplifier 1 Audio power amplifier
Microduino-BM 1 Battery management

Hardware Buildup

  • Setup 1:Connect the CoreUSB to the computer, open the program examples, select the right board and serial monitor, and then download the program.
  • Setup2:Connect the Touch sensor to Sensorhub D6 and the PIR to D10.
Microduino-sensorhub rule.JPG
  • Setup3:Connect the battery with BM.

Software Debugging

Code Description

  • Define the Control Pin
#define humanHotSensor 10
#define buttonPin 6
  • Detect human infrared and play audio.
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();
  }
}
  • Judge if some touch the button.
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();
    }
  }
}

Program

[MicroduinoSkreech]

Result

It can detect human movement. When someone passes by, it'll scream. By touching the button, it will stop screaming.

Video