image

Use Arduino to create music playback + flash instruments with the rhythm

Use Arduino to create music playback + flash instruments with the rhythm 1. Experimental Equipment Arduino development board, a breadboard, some Dupont wires, some LED lights, some 220 ohm resistors, and a buzzer. 2. Experimental operation Connect the positive poles of the six LED lights to ports 2-7 of the I/O interface of the Arduino board in sequence, Connect the negative pole of the power supply to a 220 ohm resistor. The overall negative electrode is connected to the GND interface of the arduino board. The positive pole of the buzzer is connected to port 8 of the I/O interface of the arduino board, and the negative pole is connected to GND. 3. Code implementation int buzzer=8; //Set the number that controls the buzzer. Set the number that controls the buzzer. IO pin int BASE = 2; //The I/O pin connected to the first LED int NUM = 6; //Total number of LEDs int song[] = { /* Children’s song “Little Star” */ 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, 415,415,370,370,330,330,311, 415,415,370,370,330,330,311, 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, 415,415,370,370,330,330,311, 415,415,370,370,330,330,311, 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, }; void setup() { for (int thisNote = 0; thisNote <154; thisNote++) { int noteDuration = 1000/noteDurations[thisNote]; // Calculate the time of each beat. Taking one beat…

image

Use Arduino to create music playback + flash instruments with the rhythm

Use Arduino to create music playback + flash instruments with the rhythm 1. Experimental Equipment Arduino development board, a breadboard, some Dupont wires, some LED lights, some 220 ohm resistors, and a buzzer. 2. Experimental operation Connect the positive poles of the six LED lights to ports 2-7 of the I/O interface of the Arduino board in sequence, Connect the negative pole of the power supply to a 220 ohm resistor. The overall negative electrode is connected to the GND interface of the arduino board. The positive pole of the buzzer is connected to port 8 of the I/O interface of the arduino board, and the negative pole is connected to GND. 3. Code implementation int buzzer=8; //Set the number that controls the buzzer. Set the number that controls the buzzer. IO pin int BASE = 2; //The I/O pin connected to the first LED int NUM = 6; //Total number of LEDs int song[] = { /* Children’s song “Little Star” */ 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, 415,415,370,370,330,330,311, 415,415,370,370,330,330,311, 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, 415,415,370,370,330,330,311, 415,415,370,370,330,330,311, 277,277,415,415,466,466,415, 370,370,330,330,311,311,277, }; void setup() { for (int thisNote = 0; thisNote <154; thisNote++) { int noteDuration = 1000/noteDurations[thisNote]; // Calculate the time of each beat. Taking one beat…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索