142
www.keyestudio.com
Project 7: Accelerometer
(1)Project Description
The micro:bit board has a built-in Freescale MMA8653FC three-axis
acceleration sensor (accelerometer). Its I2C interface works on external
communication, the range can be set to ± 2g, ± 4g, and ± 8g, and the
maximum data update rate can reach 800Hz.
When the Micro:bit is stationary or moving at a constant speed, the
accelerometer only detects the gravitational acceleration; when the
Micro:bit is slightly shaken, the acceleration detected is much smaller than
the gravitational acceleration and can be ignored. Therefore, in the process
of using Micro:bit, the main purpose is to detect the changes of the
gravitational acceleration on the x, y, and z axes when the attitude
changes.
For this project, we will introduce the detection of several special postures
by the accelerometer.
(2)Experimental Preparation:
Connect micro:bit to computer with the USB cable
Open online Makecode editor
Summary of Contents for 4WD Bluetooth Multi-functional Car
Page 21: ...21 www keyestudio com Installation Diagram Prototype Part 2...
Page 22: ...22 www keyestudio com Components Needed Installation Diagram...
Page 23: ...23 www keyestudio com Prototype Part 3...
Page 24: ...24 www keyestudio com Components Needed Installation Diagram...
Page 26: ...26 www keyestudio com Components Needed Installation Diagram mind the installation direction...
Page 27: ...27 www keyestudio com Prototype Part 5 Components Needed...
Page 28: ...28 www keyestudio com Installation Diagram Prototype Part 6...
Page 29: ...29 www keyestudio com Components Needed Installation Diagram...
Page 30: ...30 www keyestudio com Prototype Part 7 Components Needed...
Page 31: ...31 www keyestudio com Installation Diagram mind the direction of the motor Prototype Part 8...
Page 33: ...33 www keyestudio com Prototype Part 9 Components Needed...
Page 34: ...34 www keyestudio com Installation Diagram Prototype Part 10...
Page 35: ...35 www keyestudio com Components Needed Installation Diagram...
Page 36: ...36 www keyestudio com Prototype Start Wiring The wiring of the RGB lights...
Page 39: ...39 www keyestudio com The wiring of the servo The wiring of the M1 motor...
Page 40: ...40 www keyestudio com The wiring of the M2 motor The wiring of the M3 motor...
Page 45: ...45 www keyestudio com...
Page 47: ...47 www keyestudio com...
Page 50: ...50 www keyestudio com You can also directly drag the hex file onto the MICROBIT E disk...
Page 56: ...56 www keyestudio com Click Next...
Page 57: ...57 www keyestudio com Click another Next...
Page 60: ...60 www keyestudio com...
Page 66: ...66 www keyestudio com...
Page 67: ...67 www keyestudio com...
Page 69: ...69 www keyestudio com Click the Explorer on the left side...
Page 73: ...73 www keyestudio com Click Import File...
Page 88: ...88 www keyestudio com block...
Page 93: ...93 www keyestudio com Complete Program...
Page 99: ...99 www keyestudio com leave it below clear screen block Complete Program...
Page 116: ...116 www keyestudio com Complete Program...
Page 120: ...120 www keyestudio com...
Page 121: ...121 www keyestudio com...
Page 122: ...122 www keyestudio com...
Page 140: ...140 www keyestudio com...
Page 163: ...163 www keyestudio com Project 9 Speaker...
Page 166: ...166 www keyestudio com forever block Click the little triangle to select happy hello yawn...
Page 173: ...173 www keyestudio com side of 0 0 and change the 0 on the right side to 1000 Complete Program...
Page 184: ...184 www keyestudio com...
Page 189: ...189 www keyestudio com...
Page 190: ...190 www keyestudio com...
Page 192: ...192 www keyestudio com Secondly click Pair a new micro bit...
Page 194: ...194 www keyestudio com...
Page 195: ...195 www keyestudio com...
Page 198: ...198 www keyestudio com...
Page 200: ...200 www keyestudio com...
Page 201: ...201 www keyestudio com...
Page 202: ...202 www keyestudio com Name the code as 1 and click to save it...
Page 204: ...204 www keyestudio com...
Page 205: ...205 www keyestudio com...
Page 211: ...211 www keyestudio com Code 2 File Type Path File Name...
Page 218: ...218 www keyestudio com Complete Code...
Page 219: ...219 www keyestudio com...
Page 225: ...225 www keyestudio com Complete Code...
Page 227: ...227 www keyestudio com...
Page 230: ...230 www keyestudio com Click JavaScript to switch into the corresponding JavaScript code...
Page 235: ...235 www keyestudio com Click Neopixel to move strip show block under pause as 500...
Page 236: ...236 www keyestudio com Complete Code...
Page 244: ...244 www keyestudio com Copy once and change the of to Complete Program...
Page 249: ...249 www keyestudio com Back...
Page 250: ...250 www keyestudio com...
Page 258: ...258 www keyestudio com Click JavaScript to view the corresponding JavaScript code...
Page 275: ...275 www keyestudio com Complete Program...
Page 282: ...282 www keyestudio com respectively...
Page 284: ...284 www keyestudio com Complete Program...
Page 286: ...286 www keyestudio com...
Page 296: ...296 www keyestudio com...
Page 299: ...299 www keyestudio com 4 Test Code Code path...
Page 307: ...307 www keyestudio com 12 Change to and place it in the first else...
Page 309: ...309 www keyestudio com Complete Program...
Page 310: ...310 www keyestudio com...
Page 311: ...311 www keyestudio com Click JavaScript to view the corresponding JavaScript code...
Page 319: ...319 www keyestudio com Place car stop to the last else Complete Program...
Page 320: ...320 www keyestudio com Click JavaScript to view the corresponding JavaScript code...
Page 331: ...331 www keyestudio com The key value is displayed as for your reference...
Page 332: ...332 www keyestudio com 19 2 IR Remote Control...
Page 334: ...334 www keyestudio com 3 Flow Chart 4 Test Code Code path...
Page 339: ...339 www keyestudio com 9 Click Functions of Advance to find and drag to the second then...
Page 340: ...340 www keyestudio com 10 Copy val2 70 once and place it behind the first if change the 70...
Page 341: ...341 www keyestudio com behind to 68 11 Click Functions of Advance to find and drag to the...
Page 345: ...345 www keyestudio com Complete Program...
Page 355: ...355 www keyestudio com...
Page 362: ...362 www keyestudio com...
Page 366: ...366 www keyestudio com...
Page 367: ...367 www keyestudio com Click JavaScript to view the corresponding JavaScript code...