
72
1
Set the KEYES-2812-18R module to turn on 18 RGB LEDs in various colors. When micro:bit robot moves
forward, 18 RGB LEDs turn on blue light; robot moves backward, 18 RGB LEDs turn on purple light; robot stops,
18 RGB LEDs turn on red light.
2
Measure the distance between the robot and obstacles using an ultrasonic sensor.
3
When the measured distance is greater than or equal to 10cm, the micro:bit robot moves forward; if
less than or equal to 6cm, robot will move backward; if greater than 6cm but less than 10cm, or greater than
30cm, robot will stop.
Source Code
Summary of Contents for Micro:bit Mini Smart Robot Car V2
Page 1: ...Micro bit Mini Smart Robot Car V2...
Page 12: ...3 The front and back view are shown as below picture...
Page 14: ...5...
Page 17: ...8...
Page 20: ...11...
Page 21: ...12 e Finally you should get the parts below...
Page 22: ...13...
Page 24: ...15...
Page 28: ...2...
Page 29: ...3 3 After that click Next to continue the installation...
Page 30: ...4 4 Wait the driver installing finished...
Page 31: ...5 5 Completing the driver installation...
Page 33: ...7 You can check the detailed Ports information shown as below...
Page 36: ...10 Click the JavaScript you can see the corresponding program code Shown as below figure...
Page 41: ...15...
Page 43: ...17...
Page 44: ...18...
Page 45: ...19 Get Started with Micro bit Robot Projects...
Page 46: ...20 Get Knowledge of Micro bit Shield Elements...
Page 48: ...22 Birthday...
Page 51: ...25 Source Code...
Page 55: ...29 Then click Advanced find the Extensions to add file...
Page 56: ...30 Search neopixel then add the library file...
Page 57: ...31...
Page 58: ...32 Library added well you should see the Neopixel on the Blocks interface...
Page 59: ...33 Test code 1 You can drag the code file to the MicrosoftMakeCode window...
Page 64: ...38 Then click Advanced find the Extensions to add file...
Page 65: ...39 Enter https github com jdarling pxt pca9685 and search...
Page 66: ...40 Then you will get the pca9685 below...
Page 67: ...41 Click the pca9685 to download the extension...
Page 68: ...42 Finally you should see the PCA9685 project is added successfully...
Page 69: ...43 Test code 1...
Page 70: ...44 Test code 2...
Page 80: ...54 Line Tracking Robot...
Page 82: ...56...
Page 83: ...57 Source Code...
Page 87: ...61...
Page 89: ...63 Ultrasonic Following Robot...
Page 92: ...66...
Page 94: ...68 Source Code...
Page 96: ...70...
Page 99: ...73...
Page 101: ...75 Obstacle Avoiding And Following Robot...
Page 103: ...77...
Page 105: ...79...
Page 109: ...83 Source Code...
Page 113: ...87 Source Code...
Page 115: ...89 Infrared Control Robot...
Page 121: ...95 Then click Advanced find the Extensions to add file...
Page 122: ...96 Enter https github com jhlucky maqueen and search...
Page 123: ...97 Then you will get the maqueen file below...
Page 124: ...98 Click the maqueen file to download the extension...
Page 125: ...99 Finally you should see the maqueen project is added successfully...
Page 126: ...100 Code...
Page 128: ...102...
Page 129: ...103...
Page 130: ...104 We have listed out the key value of infrared remote control See the figure below...
Page 132: ...106 Source Code...
Page 134: ...108 Key on IR remote control Robot status Move forward Move backward Turn left Turn right stop...
Page 135: ...109 Bluetooth Control Robot...
Page 138: ...112...
Page 139: ...113 Then click Advanced find the Extensions to add file...
Page 140: ...114 Then click the Bluetooth...
Page 141: ...115 Select Remove extensions and add Bluetooth...
Page 142: ...116 Finally you should see the Bluetooth is added well...
Page 144: ...118 Finally you should see the library blocky Talky BLE is added successfully...
Page 145: ...119 Source Code Right click the source code to send to micro bit main board...
Page 152: ...126...
Page 154: ...128...
Page 155: ...129 Step 3 open the micro bit interface click Choose micro bit...
Page 156: ...130 Then click Pair a micro bit and click Next...
Page 158: ...132 Step 5 copy the pattern from your micro bit device and tap Next...
Page 159: ...133 Continue to tap Next to pair...
Page 160: ...134 OK pairing successful...
Page 164: ...138 Step 8 write the code...
Page 167: ...141 OK Flashing successful...
Page 169: ...143 Source Code...
Page 172: ...146...
Page 173: ...147 Step 3 open the micro bit interface click Choose micro bit...
Page 174: ...148 Then click Pair a micro bit and click Next...
Page 176: ...150 Step 5 copy the pattern from your micro bit device and tap Next...
Page 177: ...151 Continue to tap Next to pair...
Page 178: ...152 OK pairing successful...
Page 180: ...154 Step 7 Tap the Add and then select the Gamepad...
Page 181: ...155 And you should see the control interface shown below Click Start to connect...
Page 182: ...156 Connection successful Click Stop to disconnect...