Pi Supply bit:buggy Project 07 – Turn over detection
What happens when your bit:buggy accidentally flips over? Well it keeps running. In this project we are going to detect when the bit:buggy flips and then switch off the motors.
Connect your hardware
If you haven’t done so already, connect the left servo wheel to P1 and the right servo wheel to P2.
Step 1 – Snap the
on start block from the Basic. Set Neopixel with 24 LEDs in RGB format for colourful light and show rainbow from 1 to 360. Then, initialise the P1 port to left wheel and the P2 port to right wheel.
Step 2 – Set a variable to state for controlling car’s running. Then set state variable under the logo up block to true and the other to false.
Step 3 – Set the rainbow led to colourful lights under the
forever loop in gradual change. Use the variable state to control car’s running.
Step 4 – Upload your program to the bit:buggy
Here is the program link – https://makecode.microbit.org/_D69AjDCi78UV
The car will run normally until it get flipped over where it will stop the motors.
- 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