Little Song-Order Machine

From Microduino Wiki
Revision as of 06:26, 8 October 2016 by Fengfeng (talk) (Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Make a little song-order machine, which will play different songs when different swi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Outline

Anywhere musicplay.jpg

Make a little song-order machine, which will play different songs when different switches are pressed.


Suitable kits: mCookie202, mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply mCookie-Hub 1 Sensor adapter plate
Buzzer 1 Make sound
Crash 2 Crash sensor

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Sensor shell*1
  • Lego or other fixation structure
Anywhere musicplay-module.jpg


Module Setup

Anywhere musicplay-module—step.jpg
  • Assemble modules and sensors:
    • Stick the red core module, battery base and green extension module together;
    • Connect the buzzer to pin 6/7 of Hub;
    • Connect the two crash sensor to pin 2/3 and 4/5 of Hub respectively;
    • Insert one end of USB cable into USB upload module, and connect the other to computer;


Programming

Required Program Blocks

Programming Thought

Judge which crash is pressed with “if-do” condition statement, and play the corresponding song,and continue to judge after playing.

Mixly-ctrl-musicplay.jpg

Start Programming

1. Press the crash of pin 4, an it will start to play the song “Doraemon”.
With “if-do”, “crash sensor”, “buzzer on-song” program block, modify the pin number as the diagram shows, and choose song “Doraemon” or other songs.

Mixly-ctrl-musicplay-code1.jpg

2. Press the crash of pin 2, and it will start to play the song “Calabash Boys”.
With “if-do”, “crash”, “buzzer on-song” program block, modify the pin number as the diagram shows, and choose the song “Calabash Boys”.

Mixly-ctrl-musicplay-code2.jpg

Test the result
After upload the program, press the crash of pin 4, an it will start to play the song “Doraemon”; press the crash of pin 2, and it will start to play the song “Calabash Boys”. In this way, our little song-order machine is completed! Of course, you can also choose other songs to play.

Anywhere musicplay.jpg

Technical Specification

  • The product number of buzzer:
  • The buzzer is of passive buzzer type.
  • For details, please refer to Sensor-Buzzer.


Related Cases


FAQ

  • Q:Why does the buzzer not produce a sound when connect it directly to the power supply?
    • A:Because the buzzer is one kind of passive buzzer, which can only ring with changed voltage signal. The active buzzer can ring after added with voltage.


  • Q:Can the buzzer sing?
    • A:It can produce do, re, mi, fa, sol, la, si tones of different frequencies, which can make up music. You can refer to Music Painting. If you want to play the music, an audio decoding chip and horn is essential.


  • Q:Why can’t we choose songs when it is playing the music? And we can only choose when it ends up playing.
    • A:Because the “buzzer on-song” program block integrates the code, with internal procedures, it will only execute other control commands after executing the song.