Difference between revisions of "Little Song-Order Machine"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Make a little song-order machine, which will play different songs when different swi...")
 
 
(3 intermediate revisions by the same user not shown)
Line 22: Line 22:
 
|-
 
|-
 
|[[mCookie-Battery|Battery box]]||1||Program download and power supply
 
|[[mCookie-Battery|Battery box]]||1||Program download and power supply
 +
|-
 
|[[mCookie-Hub|mCookie-Hub]]||1||Sensor adapter plate
 
|[[mCookie-Hub|mCookie-Hub]]||1||Sensor adapter plate
 
|-
 
|-
Line 48: Line 49:
 
==Programming==
 
==Programming==
 
===Required Program Blocks===
 
===Required Program Blocks===
*[[“Crash” program block]]
+
*[["Crash button" program block]]
*[[“Buzzer on-song” program block]]
+
*[["Buzzer on-song" program block]]
*[[“If-do” program block]]
+
*[["If-do" program block]]
  
 
===Programming Thought===
 
===Programming Thought===
Judge which crash is pressed with “if-do” condition statement, and play the corresponding song,and continue to judge after playing.  
+
Judge which crash is pressed with "if-do" condition statement, and play the corresponding song,and continue to judge after playing.  
 
[[File:mixly-ctrl-musicplay.jpg|600px|center]]
 
[[File:mixly-ctrl-musicplay.jpg|600px|center]]
 
===Start Programming===
 
===Start Programming===
'''1. Press the crash of pin 4, an it will start to play the song “Doraemon”.'''
+
'''1. Press the crash of pin 4, an it will start to play the song "Doraemon".'''
 
<br>
 
<br>
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.
+
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.
 
[[File:mixly-ctrl-musicplay-code1.jpg|600px|center]]
 
[[File:mixly-ctrl-musicplay-code1.jpg|600px|center]]
'''2. Press the crash of pin 2, and it will start to play the song “Calabash Boys”.'''
+
'''2. Press the crash of pin 2, and it will start to play the song "Calabash Boys".'''
 
<br>
 
<br>
With “if-do”, “crash”, “buzzer on-song” program block, modify the pin number as the diagram shows, and choose the song “Calabash Boys”.
+
With "if-do", "crash button", "buzzer on-song" program block, modify the pin number as the diagram shows, and choose the song "Calabash Boys".
 
[[File:mixly-ctrl-musicplay-code2.jpg|600px|center]]
 
[[File:mixly-ctrl-musicplay-code2.jpg|600px|center]]
 
'''Test the result'''
 
'''Test the result'''
 
<br>
 
<br>
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.  
+
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.  
 
[[File:anywhere_musicplay.jpg|600px|center]]
 
[[File:anywhere_musicplay.jpg|600px|center]]
 
==Technical Specification==
 
==Technical Specification==
Line 77: Line 78:
 
<br>
 
<br>
 
==FAQ==
 
==FAQ==
*Q:Why does the buzzer not produce a sound when connect it directly to the power supply?  
+
*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.  
+
**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.  
 
<br>
 
<br>
*Q:Can the buzzer sing?
+
*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.  
+
**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.  
 
<br>
 
<br>
*Q:Why can’t we choose songs when it is playing the music? And we can only choose when it ends up playing.  
+
*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.  
+
**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.  
 
|}
 
|}

Latest revision as of 10:30, 9 October 2016


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 button", "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.