Make an electronic greeting card which can play Happy Birthday to You automatically as it is open.
Suitable kits: mCookie102, mCookie202, mCookie302, IBC
- USB cable*1
- Sensor cable*1
- Sensor shell*1
- Lego or other fixation structure
- Assemble the modules and sensors:
- Stick the red core module, battery base and green extension module together;
- Connect the line finder to pin A0/A1 of Hub;
- Connect the buzzer to pin 6/7 of Hub;
- Insert one end of USB cable into the USB upload module, and connect the other to the computer;
Required Program Blocks
Wait for the line finder to detect the distance, and judge whether it is larger than 300, if it is, it will play the music.
Start to Program
Wait for the distance value of line finder to be larger than 300（open the card）, and then play the Happy Birthday to You.
Test the result
After upload the program, it will play Happy Birthday to You just as the line finder isn’t covered.
Q: Can a color LED be added to the electronic greeting card?
A: Yes, it can, you can make it light up while the Happy Birthday to You is played.
Active the color LED before play the Happy Birthday to You. Turn the color LED off after the song is over.
- Q: Why can't the buzzer ring, directly connected to the power supply?
- A: Because the buzzer belongs to passive buzzer, only changed voltage signal can make it ring. It is the active buzzer that can ring after added voltage.
- Q: Can the buzzer sing?
- A: It can emit do, re, mi, fa, sol, la, si of different frequencies, and can make up music, please refer to Music Painting. If you want to play music, audio decoder chip and horn are required.