Pi Supply bit:buggy Project 04 – Here comes the Police
In this project we are going to introduce you to the LED module attached to the bottom of the bit:buggy. We are going to create a little Police bit:buggy that will chase you around whilst flashing its lights on and off.
Connect your hardware
If you haven’t done so already, connect the left servo wheel to P1 and the right servo wheel to P2.
Slide the clip switch of the special expansion board to the Rainbow LED.
Step 1 – Snap on the block “set left wheel at P1 right wheel at P2” on the “on start” block. The port numbers here are base don the actual servo motors connected.
Now add “go straight at full speed”
Finally snap together then “set strip to” with the block “NeoPixel at pin P0 with 2 leds as RGB (GRB Format)”, it should look something like below. All these block must be placed in the correct order under “On start”.
Step 2 – Within the
forever block, snap below blocks in line:
show color redblock
show color blueblock
Step 3 – Upload your code to the bit:buggy
Here is the program link – https://makecode.microbit.org/_6MxWgCYkW9j9
The bit:buggy will move straight at full speed whilst flashing its LEDs red and blue alternate to simulate a Police car.
Taking it further
How can you make your bit:buggy flash white and yellow, whilst moving in different directions. Can you add flashing indicators on whilst turning left or right?
- Project 01 – Full speed ahead
- Project 02 – Make a shape
- Project 03 – Turn at an angle
- Project 04 – Here comes the police
- Project 05 – Crazy dance
- Project 06 – Remote control
- Project 07 – Turns over detection
- Project 08 – Light follow
- Project 09 – Remote control by an accelerometer