City Defender - A Police Car | Maqueen Plus V2 Getting started Tutorial 04

0 2992 Easy

There are so many city defender heroes in movies, and have you ever considered being one of them? Now let's turn this Maqueen Plus V2 into a city defender - a police car to make your dream come true!

Goal

1. Learn how to use the buzzer module

2. Learn how to use the RGB light module

Electronic Component

Command Learning

Hands-on Practice

Step 1 Create a New Project

1. Input https://makecode.microbit.org/ into your browser to enter the MakeCode editor.

2. Click "new project" to enter the MakeCode programming interface.

3. Add the Maqueen Plus V2 library: https://github.com/DFRobot/pxt-DFRobot_MaqueenPlus_v20

Step 2 Programming

1. Program the car to make it drive

Both motors move forward at the speed of 255.

2. Program the lighting effect

Since the lights on a police car emit red light and blue light alternatively, the next step here is to exchange the lighting color every 1s.

3. Program the siren

Play the built-in sound "dadadum" repeatedly to simulate the sound of a siren.


4. The whole program is shown below.

5. Name your project as "City Defender-A Police Car" and save it.

Step 3 Download Program

1. Connect to a computer: Connect the micro:bit to your computer with a USB cable before downloading. There will be a hard disk named "micro:bit" appearing in the computer when the connection is successful.

2. Download the program: Click "Download" to download your project into the micro:bit hard disk.

3. Plug in the micro:bit board: After downloading the program, unplug the USB cable and plug the micro:bit board into Maqueen Plus V2.

Step 4 Effect Display

Turn on the power switch, then Maqueen Plus V2 moves forward with siren wailing and lights flashing, just like a police car.

Think & Explore

We have learned how to play the built-in music in MakeCode. Do you want to make a piece of your music? Try it with Maqueen Plus V2. The block shown below is used to play notes.

Click Buy micro:Maqueen Plus V2 (Ni MH Rechargeable Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot

Click Buy micro:Maqueen Plus V2 (18650 Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot

Engage in learning the next Robot project:Light Sensing Robot

Engage in learning the previous Robot project : Walking Emoji

 

License
All Rights
Reserved
licensBg
0