Electronic Greeter
From Microduino Wiki
Language: | English • 中文 |
---|
ContentsObjectiveThis Electronic Greeter will play happy music when someone walking by. SchematicMicroduino-PIR sensor will detect if there is someone moving. If there is, this device will get lighten and play music, which lasts for a while and then stop. Equipment
Program Download
Software Debugging
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
//#define AUDIO_PORT Serial1 //Core+
#define AUDIO_PORT mySerial //Core
#define humanHotSensor 4//PIR sensor D4
#define PIN 6//Colored light
if (humanHotState) {
colorWipe(strip.Color(125, 125, 125));//The colored light is on
if (!playing) {
Serial.println("play sound.....");
// audio_play();
audio_choose(1);//Play audio
playing = true;
}
}
else
{
playing = false;
//audio_pause();
Serial.println("stop sound.....");
colorWipe(strip.Color(0, 0, 0));
} Hardware Buildup
For connection method, please refer to the following picture. Mind connection order, which starts from LED interface IN to Out. It can control six LED lights at most.
[File:CoreUSB_Ble_steup2.jpg|600px|center]]
Attention! Audio must be powered through BM, which cannot be stacked with Coreusb and be powered through computer or it will fail to work. ResultWhen it detects someone moves, the colored led will turn on and play music. You can build a beautiful frame with LEGO. Video |