315
Start
Servo rotates 90°
,
and
ultrasonic sensor obtains
the front detected distance
the front detected
distance<10cm
?
YES
Go back
NO
the front detected
distance<20cm
?
Stop
YES
NO
the front detected
distance<40cm
?
Go forward
YES
NO
Stop
(4)Test Code:
Code path:
File Type
Path
File Name
Hex file KS4031(4032) folder/Makecode
Tutorial/Makecode Code/Project
18.3
:
Ultrasonic Follow Smart
Car.hex
Project 18.3
:
Ultrasonic
Follow Smart Car.hex
Summary of Contents for Keyestudio 4WD Mecanum Robot Car
Page 21: ...21 Installation Diagram Prototype Part 2 ...
Page 22: ...22 Components Needed Installation Diagram ...
Page 23: ...23 Prototype Part 3 ...
Page 24: ...24 Components Needed Installation Diagram ...
Page 26: ...26 Components Needed Installation Diagram mind the installation direction ...
Page 27: ...27 Prototype Part 5 Components Needed ...
Page 28: ...28 Installation Diagram Prototype Part 6 ...
Page 29: ...29 Components Needed Installation Diagram ...
Page 30: ...30 Prototype Part 7 Components Needed ...
Page 31: ...31 Installation Diagram mind the direction of the motor Prototype Part 8 ...
Page 33: ...33 Prototype Part 9 Components Needed ...
Page 34: ...34 Installation Diagram Prototype Part 10 ...
Page 35: ...35 Components Needed Installation Diagram ...
Page 36: ...36 Prototype Start Wiring The wiring of the RGB lights ...
Page 37: ...37 The wiring of the infrared receiver module The wiring of the motor and colorful lights ...
Page 38: ...38 The wiring of the line tracking sensor The wiring of the ultrasonic sensor ...
Page 39: ...39 The wiring of the servo The wiring of the M1 motor ...
Page 40: ...40 The wiring of the M2 motor The wiring of the M3 motor ...
Page 45: ...45 ...
Page 47: ...47 ...
Page 50: ...50 You can also directly drag the hex file onto the MICROBIT E disk ...
Page 56: ...56 Click Next ...
Page 57: ...57 Click another Next ...
Page 60: ...60 ...
Page 66: ...66 ...
Page 67: ...67 ...
Page 69: ...69 Click the Explorer on the left side ...
Page 73: ...73 Click Import File ...
Page 74: ...74 Select Makecode Code Project 1_ Heart beat Project 1_ Heart beat hex Then click Go ahead ...
Page 88: ...88 block ...
Page 93: ...93 Complete Program ...
Page 99: ...99 leave it below clear screen block Complete Program ...
Page 105: ...105 3 Copy once and set to on button A B pressed and show string AB Complete Code ...
Page 116: ...116 Complete Program ...
Page 120: ...120 ...
Page 121: ...121 ...
Page 122: ...122 ...
Page 140: ...140 ...
Page 159: ...159 A Click Basic pause ms 100 B Lay it down into forever and set to 100ms Complete Program ...
Page 163: ...163 Project 9 Speaker ...
Page 166: ...166 forever block Click the little triangle to select happy hello yawn ...
Page 173: ...173 side of 0 0 and change the 0 on the right side to 1000 Complete Program ...
Page 184: ...184 ...
Page 189: ...189 ...
Page 190: ...190 ...
Page 192: ...192 Secondly click Pair a new micro bit ...
Page 194: ...194 ...
Page 195: ...195 ...
Page 197: ...197 A few seconds later the match is done and the LED dot matrix displays the pattern ...
Page 198: ...198 ...
Page 200: ...200 ...
Page 201: ...201 ...
Page 202: ...202 Name the code as 1 and click to save it ...
Page 204: ...204 ...
Page 205: ...205 ...
Page 211: ...211 Code 2 File Type Path File Name ...
Page 218: ...218 Complete Code ...
Page 219: ...219 ...
Page 225: ...225 Complete Code ...
Page 227: ...227 ...
Page 230: ...230 Click JavaScript to switch into the corresponding JavaScript code ...
Page 235: ...235 Click Neopixel to move strip show block under pause as 500 ...
Page 236: ...236 Complete Code ...
Page 244: ...244 Copy once and change the of to Complete Program ...
Page 249: ...249 Back ...
Page 250: ...250 ...
Page 258: ...258 Click JavaScript to view the corresponding JavaScript code ...
Page 274: ...274 11 Click Basic to find and drag show leds to else Click these blocks to form the pattern ...
Page 275: ...275 Complete Program ...
Page 282: ...282 ...
Page 284: ...284 Complete Program ...
Page 286: ...286 ...
Page 296: ...296 ...
Page 304: ...304 9 Copy once Change the 180 to 0 distance_l to distance_r and others remain unchanged ...
Page 307: ...307 12 Change to and place it in the first else ...
Page 308: ...308 11 Click Funtionsto of Advance to find and drag and place it to the second else ...
Page 309: ...309 Complete Program ...
Page 310: ...310 ...
Page 311: ...311 Click JavaScript to view the corresponding JavaScript code ...
Page 318: ...318 6 change the 10 to 20 car_back to car stop 7 change the 20 to 40 car stop to car forward ...
Page 319: ...319 Place car stop to the last else Complete Program ...
Page 320: ...320 Click JavaScript to view the corresponding JavaScript code ...
Page 331: ...331 The key value is displayed as for your reference ...
Page 332: ...332 19 2 IR Remote Control ...
Page 339: ...339 9 Click Functions of Advance to find and drag 指 to the second then ...
Page 340: ...340 10 Copy val2 70 once and place it behind the first if change the 70 ...
Page 341: ...341 behind to 68 11 Click Functions of Advance to find and drag to the ...
Page 345: ...345 Complete Program ...
Page 355: ...355 ...
Page 362: ...362 ...
Page 366: ...366 ...
Page 367: ...367 Click JavaScript to view the corresponding JavaScript code ...