Pi Supply bit:buggy Project 08 – Light follow

In this project we are going to make the bit:buggy follow a single light source such as a torch light or the light on your phone. As you move the light source the bit:buggy will follow and change direction according.

Connect your hardware

If you haven’t done so already, connect the left servo wheel to P1 and the right servo wheel to P2.

Coding

Step 1 – Snap in place the block “go straight at full speed” into the “On start” block. The port number is the actual servo connection port.

Step 2 – Snap the light level from the Input. The car will move to the light source when the light level is greater than the defined value. The car will spin around to find the light source when the light level is less than the defined value.

Step 3 – Upload your program to the bit:buggy

Program link – https://makecode.microbit.org/_Ds9Fss3c6Mbt

 Action

The car initially will spin around and then follow the nearest and brightest light source.

Project Examples

 

First published at 4:56pm on October 30, 2019
Last updated at 3:51pm on December 12, 2019