background image

 

                                                                                                                                                                     

 

 

 

160 

 

 

 

 

Click

JavaScript" to switch into the corresponding JavaScript code:   

 

 

 

“on start”

: command block runs once to start program. 

Serial redirects to USB 

The program under the block

forever

runs cyclically. 

Serial write value 

Light intensity

 

= light level 

Delay in 100ms 

Summary of Contents for Keyestudio 4WD Mecanum Robot Car

Page 1: ...1 Keyestudio 4WD Mecanum Robot Car Makecode Contents 1 Introduction 4 2 Description 6 3 Parameters 6 4 Kit List 7 5 Preparations 12 ...

Page 2: ...bout Keyestudio 4WD Mecanum Robot Car 18 6 2 the Installation of keyestudio 4WD Mecanum Robot Car 20 7 Get Started with Micro bit 42 7 1 Write code and program 42 7 2 Makecode 53 7 3 Quick Download 54 7 4 Makecode extension library 62 7 4 Resources and test code 71 7 5 Input test code 72 7 6 Install CoolTerm 77 8 Projects 79 Project 1 Heartbeat 80 Project 2 Light A Single LED 83 Project 3 LED Dot ...

Page 3: ...ation 187 Project 13 Colorful Lights 208 Project 14 WS2812 RGB LEDs 215 Project 15 Servo 238 Project 16 Motor 247 Project 17 Line Tracking Sensor 260 17 1 Detect Line Tracking Sensor 260 17 2 Line Tracking Smart Car 278 Project 18 Ultrasonic Follow Smart Car 288 18 1 Ultrasonic Ranging 288 18 2 Ultrasonic Avoidance Car 297 18 3 Ultrasonic Follow Smart Car 313 Project 19 IR Remote Control 322 19 1 ...

Page 4: ...raphical programming platforms from micro bit to Arduino and Raspberry Pi Maybe you haven t heard of them before It doesn t matter because with the help of this product and tutorial you can easily install a multi functional programming car and experience the fun of being a maker Micro bit is a highly integrated microcontroller of powerful functions and small size It is very suitable to be applied ...

Page 5: ...nly experience the fun of creation but enhance hands on ability and learn programming skills as well MakeCode for micro bit is the most widely used graphical programming environment on the micro bit official website It is based on the graphical programming environment developed by Microsoft s open source project MakeCode This graphical programming can also be converted to code languages python and...

Page 6: ...talling and disassembling the battery please pay attention to the positive and negative poles of the battery and be sure not to reverse the them By the way the motor speed of this product is adjustable In order to provide you with better experience corresponding documents about installation and test code are also provided 3 Parameters Connector port input DC 6V 9V Operating voltage of drive board ...

Page 7: ...o bit is 3 3V driver shield integrates 3 3V 5V communication conversion circuit 4 Kit List Picture Components Quanti ty 1 KS0511 Acrylic Board T 3mm 1 2 Acrylic Board with Lego Holes T 3mm 1 3 4 5V Motor 4 4 23 15 5MM Fixing Board 4 ...

Page 8: ...8 5 Servo 1 6 Mecanum Wheels 4 7 Keyestudio Micro bit IO Port Expansion Sensor Shield With Level Conversion 1 8 Micro bit Main Board V2 0 with Package for KS4031 1 Micro bit Main Board V2 0 for KS4032 0 ...

Page 9: ...9 9 Keyestudio Driver Board 1 10 M3 20MM Dual pass Copper Pillar 4 11 4265c Lego Part 4 12 43093 Lego Part 4 13 Acrylic Gasket Six in One Pack 1 ...

Page 10: ...10 14 M3 6MM Round Head Screw 18 15 Keyestudio Ultrasonic Module 1 16 M3 Nickle plated Nut 14 17 M3 30MM Round Head Screw 9 18 M2 Nickle plated Nut 3 19 M2 8MM Round Head Screw 3 ...

Page 11: ...ad Screw 5 21 Remote Control without batteries 1 22 Plastic String 3 100mm 5 23 USB Cable 1 24 HX 2 54 2P DuPont Wire 100mm 1 25 HX 2 54 4P DuPont Wire 50mm 2 26 XH2 54 4P DuPont Wire 160mm 1 27 XH2 54 3P DuPont Wire 50mm 2 ...

Page 12: ...core device is a 32 bit Arm Cortex M4 with FPU micro processing Though it is just the size of a credit card the Micro bit main board is equipped with loads of components including a 5 5 LED dot matrix 2 programmable buttons an accelerometer a compass a thermometer a touch sensitive logo and a MEMS microphone a Bluetooth module of low energy and a buzzer and others Thus it also boasts multiple func...

Page 13: ...pports a variety of codes and graphical programming platforms and is compatible with almost all PCs and mobile devices It has no need to install drivers It is of high integration of electronic modules and has a serial port monitoring function for easy debugging The board has found wide applications It can be applied in programming video games making interactions between light and sound controlling...

Page 14: ...n please resort to following links https tech microbit org hardware https microbit org new microbit https www microbit org get started user guide overview https microbit org get started user guide features in depth 3 Pinout ...

Page 15: ...3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P19 P20 ADC DAC P0 P1 P2 P3 P4 P10 IIC P19 SCL P20 SDA SPI P13 SCK P14 MISO P15 MOSI PWM used frequently P0 P1 P2 P3 P4 P10 PWM not frequently used P5 P6 P7 P8 P9 P11 P12 P13 P14 P15 P16 P19 P20 ...

Page 16: ...b Its IO port is very weak in driving since it can merely handle current less than 300mA Therefore do not connect it with devices operating in large current such as servo MG995 and DC motor or it will get burnt Furthermore you must figure out the current requirements of the devices before you use them and it is generally recommended to use the board together with a Micro bit shield c It is recomme...

Page 17: ...attery more than 3 3V or the main board will be damaged g Forbid to operate it on metal products to avoid short circuit To put it simple Micro bit V2 main board is like a microcomputer which has made programming at our fingertips and enhanced digital innovation And as for programming environment BBC provides a website https microbit org code which has a graphical MakeCode program easy for use 5 2 ...

Page 18: ...ted into the bottom plate an ultrasonic sensor servos 2 colorful lights 4 WS2812 RGB lights The wiring is not complicated and it has Lego jacks to facilitate connection with other peripheral devices Abundant hardware resources will enable you to master more knowledge and skills so that you can use your imagination to create more technological inventions 6 1 Basic Information about Keyestudio 4WD M...

Page 19: ...nd infrared receiver servo are integrated in the base Pins Pin on Micro bit Sensors of the keyestudio 4WD Mecanum Robot Car P1 P2 Line Tracking Sensor P14 Servo P8 4 个 WS2812RGB Lights P9 Infrared Receiver P15P16 Ultrasonic Sensor Power supply and Battery The keyestudio 4WD Mecanum Robot Car is powered by two 18650 batteries The battery holder of the car is compatible with any type of 18650 lithiu...

Page 20: ...20 charger to charge the 18650 lithium battery Please note This product does not contain batteries 6 2 the Installation of keyestudio 4WD Mecanum Robot Car Part 1 Components Needed ...

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 25: ...25 Prototype Part 4 adjust the angle of the servo first Adjust the angle of the servo to 90 degrees according to the test code in project 8 15 ...

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 32: ...32 Components Needed Installation Diagram Pay attention to the installation direction of the mecanum wheel ...

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 41: ...41 The wiring of the M4 motor The wiring of the power supply the 5V is connected to the shield ...

Page 42: ...rowse the official website of Micro bit for more details and the link is attached below https microbit org guide quick Step 1 connect the Micro Bit main board with your computer Firstly link the Micro Bit main board with your computer via the USB cable Macs PCs Chromebooks and Linux including Raspberry Pi systems are all compatible with the Micro Bit main board Note that if you are about to pair t...

Page 43: ...our computer communicates with the main board via the USB cable the yellow LED on it will flashes For example it will flicker when you burn a hex file Then Micro bit main board will appear on your computer as a driver named MICROBIT E Please note that it is not an ordinary USB disk as shown below ...

Page 44: ...pears fill it with heartbeat and click Create to edit If you are running Windows 10 system it is also viable to edit on the APP MakeCode for micro bit which is exactly like editing in the website And the link to the APP is https www microsoft com zh cn p makecode for micro bit 9pjc7sv48lcx ocid badgep rtc 1 activetab pivot overviewtab ...

Page 45: ...45 ...

Page 46: ...run your program in Simulator of MakeCode editor as shown in the picture below which demonstrates how to edit heartbeat program Click the arrow behind JS JavaScript to choose between JavaScript or Python and you will find the corresponding program in JavaScript language or Python language as shown below ...

Page 47: ...47 ...

Page 48: ...e program to your Micro Bit main board is merely clicking the Download button then all is done If you are writing program through the website following these steps Click the Download in the editor to download a hex file which is a compact program format that the Micro Bit main board can read Once the hexadecimal file is downloaded copy it to your board just like the ...

Page 49: ...49 process that you copy the file to the USB driver If you are running Windows system you can also right click and select Send to MICROBIT E to copy the hex file to the Micro Bit main board ...

Page 50: ...50 You can also directly drag the hex file onto the MICROBIT E disk ...

Page 51: ...l light on the back side of the board flashes When the copy is completed the yellow signal light will stop flashing and remain on Step 4 run the program After the program is uploaded to the Micro bit main board you could still power it via the USB cable or change to via an external power The 5 x 5 LED ...

Page 52: ...e board can only have access to hexadecimal files hex and save no other files Step 5 about other programming languages This chapter has described how to use the Micro bit main board But except for the Makecode graphical programming introduced you can also write Micro bit programs in other languages Go to the link https microbit org code to know about other programming languages or view the link ht...

Page 53: ...kecode Browse https makecode microbit org and enter Makecode online editor or open the APP MakeCode for micro bit of Windows 10 Click New Project and input heartbeat then click create to enter Makecode editor as shown below ...

Page 54: ...nly executes once while forever implies that the code runs cyclically 7 3 Quick Download As mentioned before if your computer is Windows 10 and you have downloaded the APP MakeCode for micro bit to write programs the Simulator Download code 按钮 Graphical and text Blocks 块 Save Setting 置 Code editing area 辑区 Undo 销 Return zoom in zoom out project ...

Page 55: ...er if you use Google Chrome suitable for Linux macOS and Windows 10 the process can be quicker too We use the webUSB function of Chrome to allow the internet page to access the hardware device connected USB You could refer to the following steps to connect and pair devices Device pairing Connect micro bit to your computer by USB cable Click beside Download and tap Connect device ...

Page 56: ...56 Click Next ...

Page 57: ...57 Click another Next ...

Page 58: ...ion please refer to https makecode microbit org device usb webusb troubleshoot And for updating the firmware of the Micro bit https microbit org guide firmware If the links are too troublesome for you then you can also turn to our Troubleshooting Downloads with WebUSB and upload the firmware ...

Page 59: ...59 in the folder we provided in the link https fs keyestudio com KS4031 4032 Click Done to finish the pairing ...

Page 60: ...60 ...

Page 61: ...61 Download program After the pairing click download to directly download the program to the board If it is successfully downloaded the icon will shift to ...

Page 62: ... 4 Makecode extension library For your convenience we have made a makecode extension library for this smart home kit Add smart home extension library Please follow the following steps to add extension files ...

Page 63: ...63 Open Makecode to enter a certain project click the gear shaped icon for setting in the upper right corner choose Extensions Or click Advanced to select Extensions as shown below ...

Page 64: ...64 Input the link https github com keyestudio2019 ks_IoT to search Tap the searching result IoT_keyestudio to download and install it This process may take a few seconds ...

Page 65: ...65 After the installation you can find the extension files DHT11 DHT22 and I2C_LCD1602 on the left side And extension file Neopixel is also installed ...

Page 66: ...66 ...

Page 67: ...67 ...

Page 68: ...herefore when you create a new IoT_keyestudio project you will need to add these extension files again Update or delete the IoT_keyestudio extension files Please follow the following steps to update or delete extension files Click Js JavaScript to change to textual version ...

Page 69: ...69 Click the Explorer on the left side ...

Page 70: ...70 You can find these added files in the list Click the dustbin icon beside the file to delete the corresponding file Tap the refresh icon to update the corresponding IoT_keyestudio extension file ...

Page 71: ...d test code We also provide a link https fs keyestudio com KS4031 4032 containing the information of the product from relevant tools to test codes tutorials and troubleshooting methods as well as shown in the figure below ...

Page 72: ...code blocks to complete the program for each project For simple projects dragging a block of code to complete the program is recommended For complex projects it is recommended to conduct the program by importing the hexadecimal code file we provide Let s take the Heatbeat project as an example to show how to load the code Open the Web version of Makecode or the Windows 10 App version of Makecode ...

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 75: ...ing the test code file provided into the Makecode compiler above you can also drag the the test code file provided into the code editing area of the Makecode compiler as shown in the figure below After a few seconds it is done ...

Page 76: ...fore digital signal or analog signal of sensors and modules cannot be shown on the serial port simulator However you need to read the corresponding digital signal or analog signal So what can we do You can use the CoolTerm software to read the serial port data of the microbit Next chapter is about how to install CoolTerm ...

Page 77: ...rt Download CoolTerm program https freeware the meiers org After the download we need to install CoolTerm program file below is PC Window system taken as an example 1 Choose win to download the zip file of CoolTerm 2 Unzip file and open it also suitable for Mac and Linux system 1 ...

Page 78: ...78 3 Double click please make sure that the driver of Micro bit is installed and the main board is connected with the computer The functions of each button on the Toolbar are listed below ...

Page 79: ...x of the Micro bit main board V2 Open up a new Terminal Open a saved Connection Save the current Connection to disk Open the Serial Connection Close the Serial Connection Clear the Received Data Open the Connection Options Dialog Display the Terminal Data in Hexadecimal Format Display the Help Window ...

Page 80: ...a relatively big heart shaped pattern and then a smaller one This alternative change of this pattern is like heart beating This experiment serves as a starter for your entry to the programming world 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step ...

Page 81: ...e Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 1 Heartbeat Project 1 Heartbeat hex Or you could edit code step by step in the editing area Go to Basic show icon Copy it again and place into forever block ...

Page 82: ...omplete Program Click JavaScript to view the corresponding JavaScript code on start command block runs once to start program The program under the block forever runs cyclically LED dot matrix displays LED dot matrix shows ...

Page 83: ...Project 2 Light A Single LED 1 Project Description The LED dot matrix consists of 25 LEDs arranged in a 5 by 5 square In order to locate these LEDs quickly as the figure shown below we can regarded this matrix as a coordinate system and create two aces by marking those in rows from 0 to 4 from top to bottom and the ones in columns from 0 to 4 from the left to the right Therefore the LED sat in the...

Page 84: ...ine Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step 3 Test Code The route to get test code How to load File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 2 Light A Single Project 2 Light A Single LED hex ...

Page 85: ...e editing area A Click Led more led enable false B Put it into the on start block and click the drop down triangle button to select true 2 A Enter Led toggle x 0 y 0 block B Combine it with forever alter x 0 into x 1 3 A Enter Basic pause ms 100 from ...

Page 86: ...Then move it below the toggle x1 y0 block and set to 500ms 4 Duplicate code string once and place it into forever block A Enter Led plot x 0 y 0 B Keep it beneath block pause ms 500 then set to plot x 3 y 4 ...

Page 87: ...te pause ms 500 once and keep it below the block plot x3y4 Click Led unplot x 0 y 0 and set to unplot x3 y 4 Lay down it beneath pause ms 500 block Copy pause ms 500 block once and keep it below the unplot x3 y 4 ...

Page 88: ...88 block ...

Page 89: ... runs once to start program Turn on LED dot matrix The program under the block forever runs cyclically Toggle the LED brightness at coordinate point x 1 y 0 Toggle the LED brightness at coordinate point x 1 y 0 Turn on the LED at coordinate point x3 y4 Delay in 500ms Turn off the LED at coordinate point x3 y4 ...

Page 90: ...st code to micro bit main board V2 and powering the main board via the USB cable the LED in 1 0 lights up for 0 5s and the one in 3 4 shines for 0 5s and repeat this sequence How to download How to quick download Project 3 LED Dot Matrix ...

Page 91: ... to light by integrating its position value into the test code Supported by the same theory we can turn on many LEDs at the same time to showcase patterns digits and characters What s more we can also click show icon to choose the pattern we like to display Last but not the least we can design patterns by ourselves 2 Experimental Preparation Connect micro bit to computer with the USB cable Open on...

Page 92: ...ject 3 LED Dot Matrix 1 Or you could edit code step by step in the editing area A Enter Led more led enable false Click the drop down triangle button to select true Combine it with on start block Click Led to move plot x 0 y 0 into forever then replicate plot x 0 y 0 for 8 times respectively set to x 2 y 0 x 2 y 1 x 2 y 2 x 2 y 3 x 2 y 4 x 1 y 3 x 0 y 2 x 3 y 3 x 4 y 2 ...

Page 93: ...93 Complete Program ...

Page 94: ...anguage code Code 2 on start command block only runs once to start program Turn on LED dot matrix The program under the block forever runs cyclically Toggle the LED brightness at coordinate point x 2 y 0 x 2 y 1 x 2 y 2 x 2 y 3 x 2 y 4 x 1 y 3 x 0 y 2 x 3 y 3 and x 4 y 2 ...

Page 95: ...ode Tutorial Makecode Code Project Code Project 3 LED Dot Matrix 2 Project 3 LED Dot Matrix 2 Or you could edit code step by step in the editing area A Enter Basic show number 0 block Duplicate it for 4 times then separately set to show number 1 show number 2 show number 3 show number 4 show number 5 ...

Page 96: ...forever block tick blue boxes to light LED and generate pattern 1 Move out the block show string from Basic block and leave it beneath the show leds block Choose show icon from Basic block and leave it beneath the block show string Hello block ...

Page 97: ...97 2 A Enter Basic show arrow North B Leave it into forever block replicate show arrow North for 3 times respectively set to North East South East South West North West ...

Page 98: ...98 3 Click Basic to get block clear screen then remain it below the block show arrow North West 5 Drag pause ms 100 block from Basic block and set to 500ms then ...

Page 99: ...99 leave it below clear screen block Complete Program ...

Page 100: ...m runs cyclically Dot matrix shows the pattern Dot matrix scrolls to show Hello is shown on dot matrix LED dot matrix displays North East arrow The South East arrow shows up on LED dot matrix The South West arrow appears up on LED dot matrix The North West arrow is displayed on LED dot matrix Clear the screen Delay in 500ms ...

Page 101: ...101 Select JavaScript and Python to switch into JavaScript and Python language code 4 Test Results Upload code 1 and power the board we will see the icon ...

Page 102: ...rns How to download How to quick download Project 4 Programmable Buttons 1 Project Description Buttons can be used to control circuits In an integrated circuit with a push button the circuit is connected when pressing the button and it is open the other way around Micro Bit main board boasts three push buttons two are programmable ...

Page 103: ...r and the LED dot matrix shows A B and AB respectively Let s get started 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step 3 Test Code Code 1 Press buttons on micro bit micro bit will display character strings The route to get test code How to load File Type Path...

Page 104: ...le Buttons 1 Or you could edit code step by step in the editing area 1 Delete on start and forever firstly then click Input on button A pressed 1 A Click Basic show string B Then place it into on button A pressed block change Hello into A 2 Copy code string once tap the drop down button A to select B and modify character A into B ...

Page 105: ...105 3 Copy once and set to on button A B pressed and show string AB Complete Code ...

Page 106: ...o switch into JavaScript and Python language code Code 2 Press button A on Micro bit main board Show the character A Press button B on Micro bit main board Show the character B Press button A and B at same time Display the character AB ...

Page 107: ... 2 Project 4 Programmable Buttons 2 Or you could edit code step by step in the editing area A Click Led more led enable false B Put it into the block on start click drop down triangle button to select true A Tap Variables Make a Variable New variable name B Enter item in the dialog box and click OK then variable item is produced And move set item to 0 into on start block ...

Page 108: ...essed B Go to Variables change item by 1 C Place it into on button A pressed and 1 is modified into 5 Duplicate code string once click the drop down button to select B then set change item by 5 A Enter Led plot bar graph of 0 up to 0 ...

Page 109: ...nto 0 box change 0 into 25 A Go to Logic to move out if true then and blocks B Keep into true box and set to C Select item in the Variables and lay it down at left box of change 0 into 25 D Enter Variables to drag set item to 0 block into if true then alter 0 into 25 ...

Page 110: ...110 7 A Replicate code string once B is modified into and 25 is changed into 0 C Leave it beneath code string Complete Program ...

Page 111: ...nitial value of item to 0 Press button A on Micro bit board Change item by 5 Press button B on Micro bit board Change item by 5 The program under the block forever runs cyclically Light on LED in dot matric to draw bar graph light up up to 25 LEDs If item is greater than 25 Then set item to 25 If item is less than 0 Then set item to 0 ...

Page 112: ...D dot matrix shows A if button A is pressed B if button B pressed and AB if button A and B pressed together After uploading test code 2 to micro bit main board V2 and powering the main board via the USB cable when pressing the button A the LEDs turning red increase by 5 while when pressing the button B the LEDs turning red reduce ...

Page 113: ...he temperature sensor built into NFR52833 chip for temperature detection Therefore the detected temperature is more closer to the temperature of the chip and there maybe deviation from the ambient temperature Note the temperature sensor of Micro bit main board is shown below 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor ...

Page 114: ...re The route to get test code How to load File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 5 Temperature Measurement 1 Project 5 Temperature Measurement 1 Or you could edit code step by step in the editing area Go to Advanced Serial serial redirect to USB Place it into on start ...

Page 115: ... to drag out serial write value x 0 Move it into forever block Go to Input temperature Place it into 0 box Change x into Temperature Move pause ms 100 from Basic block and place it under block serial write temperature ...

Page 116: ...116 Complete Program ...

Page 117: ...aScript to view the corresponding JavaScript code on start command block runs once to start program Serial redirect to USB The program under the block forever runs cyclically Serial writes Temperature Delay in 500ms ...

Page 118: ...118 Download code 1 to micro bit board and keep USB cable connected then tap button How to quick download Temperature data is shown below ...

Page 119: ...perature rises to 37 when it touches water cup Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate the baud rate of USB serial communication of Micro bit is 115200 through the test Click OK and Connect The serial monitor shows the current ambient temperature value as shown below ...

Page 120: ...120 ...

Page 121: ...121 ...

Page 122: ...122 ...

Page 123: ...123 Code 2 Micro bit display different pictures by temperature the temperature value in the code could be adjusted The route to get test code How to load File Type Path File Name ...

Page 124: ...rature Measurement 2 Or you could edit code step by step in the editing area You could set temperature based on real situation Click Led more led enable false into on start click drop down triangle button to select true A Go to Logic if true then else and block B Move if true then else into forever block then place into true box ...

Page 125: ... into B Go to Input temperature and move it into left 0 box C Change 0 into 35 Tap Basic show icon copy it once and lay down them under the if then and else blocks then click the drop down triangle button to select ...

Page 126: ...start command block runs once to start program Turn on LED dot matrix Under the block forever program runs cyclically If the detected temperature 35 the next program will be executed Dot matrix shows Otherwise the another program will be executed under the else block LED dot matrix displays ...

Page 127: ...re is less than 35 5 5LED will show When the temperature is equivalent to or greater than 35 the pattern will appear How to download How to quick download Project 6 Geomagnetic Sensor 1 Project Description This project mainly introduces the use of the Micro bit s compass In addition to detecting the strength of the magnetic field it can also be used to determine the direction an important part of ...

Page 128: ...determine the location We need to calibrate the Micro bit board when magnetic sensor works The correct calibration method is to rotate the Micro bit board In addition the objects nearby may affect the accuracy of readings and calibration 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and ...

Page 129: ...c Sensor 1 Project 6 Geomagnetic Sensor 1 Or you could edit code step by step in the editing area A Click Input more calibrate compass B Lay down it into block on start A Go to Input on button A pressed B Enter Basic show number put it into on button A pressed block C Tap Input compass heading and place it into show number ...

Page 130: ...s pressed LED dot matrix indicates that TILT TO FILL SCREEN then enter the calibration interface The calibration method rotate the micro bit to make LED dot matrix draw a square 25 LEDs are on as shown in the following figure on start command block only runs once to start program Calibrate compass Press button A on Micro bit main board Dot matrix shows the direction of compass heading ...

Page 131: ...til you view the smile pattern appear The serial monitor will show 0 90 180 and 270 when pressing A Code 2 Make micro bit board point to the north south east and west horizontally LED dot matrix displays the corresponding direction patterns The route to get test code How to load ...

Page 132: ...KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 6 Geomagnetic Sensor 2 Project 6 Geomagnetic Sensor 2 This module can keep reading data to determine direction so does point to the current magnetic North Pole by arrow ...

Page 133: ...n the value ranges from 292 5 to 337 5 Because 0 5 can t be input in the code the values we get are 293 and 338 Link computer with micro bit board by micro USB cable and program in MakeCode editor Enter Input more calibrate compass Move calibrate compass into on start ...

Page 134: ...k A Go to Input compass heading and keep it into 0 box Tap Logic if then else leave it below block sex x to compass heading then click icon for 6 times A Place and into true block B Then move block to the left box of and C Click Variables to drag x to the left 0 box change 0 into 293 and set to D Then copy x 293 once and leave it to the right 0 box and set to x 338 ...

Page 135: ...135 A Go to Basic show leds B Lay it down beneath block then click show leds and the pattern appears ...

Page 136: ...136 A Duplicate for 6 times B Separately leave them into the blank boxes behind else if C Set to x 23 and x 68 x 68 and x 113 x 113 and x 158 ...

Page 137: ...8 and x 203 x 203 and x 248 x 248 and x 293 respectively D Then copy show leds for 7 times and keep them below the else if then block respectively E Click the blue boxes to form the pattern and Complete Program ...

Page 138: ...the angle of the compass heading into the variable x When 293 x 338 the next program will be executed appears on the dot matrix When 23 x 68 the next program will be executed is displayed on dot matrix When 68 x 113 the next program will be executed is shown on dot matrix When 113 x 158 the next program will be executed pattern appears ...

Page 139: ...When 158 x 203 the next program will be executed Dot matrix shows When 203 x 248 the next program will be executed Dot matrix displays When 248 x 293 the next program will be executed Dot matrix shows When x is not among the above rang the next program will be executed under else block ...

Page 140: ...140 ...

Page 141: ...141 4 Test Results Upload code 2 and plug micro bit into power After calibration tilt micro bit board and the LED dot matrix displays the direction signs How to download How to quick download ...

Page 142: ...lerometer 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 dete...

Page 143: ...et test code How to load File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 7 Accelerometer 1 Project 7 Accelerometer 1 Or you could edit code step by step in the editing area 1 A Enter Input on shake B Click Basic show number place it into on shake block then change ...

Page 144: ... A Copy code string for 7 times separately click the triangle button to select logo up logo down screen up screen down tilt left tilt right and free fall then respectively change 1 into 2 3 4 5 6 7 8 Complete Program ...

Page 145: ...145 Shake the Micro bit board LED dot matrix displays 1 The log is up LED dot matrix displays 2 The logo is down LED dot matrix displays 3 The screen is up LED dot matrix displays 4 ...

Page 146: ...sponding JavaScript code The screen is down Number 5 is shown The Micro bit board is tilt to the left Number 6 is displayed The Micro bit board is tilt to the right Number7 is displayed When the Micro bit board is free fall LED dot matrix shows 8 ...

Page 147: ... of acceleration speed at x y and z axis The route to get test code How to load File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 7 Accelerometer 2 Project 7 Accelerometer 2 ...

Page 148: ...anced Serial serial redirect to USB B Drag it into on start A Enter Serial serial write value x 0 B Leave it into forever block A Click Input acceleration mg x B Keep it into 0 box and capitalize the x Go to Basic and move out pause ms 100 below the block then set to 100ms ...

Page 149: ...149 Replicate code string for 3 times and keep them into forever block separately set the whole code string as follows ...

Page 150: ...rd keep USB cable connected and click on start command block runs once to start program Serial redirects to USB The program under the block forever runs cyclically Serial write value X acceleration value on x axis Serial write value Y acceleration value on y axis Serial write value Z acceleration value on z axis ...

Page 151: ...ick download After referring to the MMA8653FC data manual and the hardware schematic diagram of the Micro Bit main board V2 the accelerometer coordinate of the Micro Bit V2 motherboard are shown in the figure below ...

Page 152: ... The following interface shows the decomposition value of acceleration in X axis Y axis and Z axis respectively as well as acceleration synthesis acceleration synthesis of gravity and other external forces ...

Page 153: ... via Google Chrome won t be able to match devices You ll need to use the CoolTerm serial monitor software to read data You could open CoolTerm software click Options select SerialPort set COM port and put baud rate to 115200 after testing the baud rate of USB ...

Page 154: ...e data of X axis Y axis and Z axis as shown in the figures below 4 Test Results After uploading the test code 1 to micro bit main board V2 and powering the board via the USB cable if we shake the Micro Bit main board V2 no matter at any direction the LED dot matrix displays the digit 1 How to download How to quick download ...

Page 155: ... upside down make its logo below the LED dot matrix it shows as below When it is placed still on the desk showing its front side the number 4 appears When it is placed still on the desk showing its back side the number 5 exhibits When the board is tilted to the left the LED dot matrix shows the number ...

Page 156: ...he board is knocked to the floor this process can be considered as a free fall and the LED dot matrix shows the number 8 please note that this test is not recommended for it may damage the main board Attention if you d like to try this function you can also set the acceleration to 3g 6g or 8g But still we do not recommend ...

Page 157: ...ain board is not equipped with a photoresistor When the light irradiates the LED matrix the voltage change will be produced Therefore we could determine the light intensity by voltage change 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step 3 Test Code ...

Page 158: ...ct 8 Light Detection Project 8 Light Detection Or you could edit code step by step in the editing area 1 A Enter Advanced Serial serial redirect to USB B Drag it into on start block 2 A Go to Serial serial write value x 0 B Move it into forever A Click Input acceleration mg x B Put acceleration mg x in the 0 box and change x into Light intensity ...

Page 159: ...159 A Click Basic pause ms 100 B Lay it down into forever and set to 100ms Complete Program ...

Page 160: ...ch into the corresponding JavaScript code on start command block runs once to start program Serial redirects to USB The program under the block forever runs cyclically Serial write value Light intensity light level Delay in 100ms ...

Page 161: ... off USB cable and click How to quick download The intensity value is 0 when covering LED dot matrix And the value varies with the light intensity When placing micro bit under the sunlight the stronger the light is the larger the intensity value is As shown below ...

Page 162: ...lick Options to select SerialPort and set COM port and 115200 baud rate the baud rate of USB serial communication of micro bit is 115200 through the test Then click OK and Connect The light intensity value is shown below ...

Page 163: ...163 Project 9 Speaker ...

Page 164: ...g the son Ode to Joy 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step 3 Test Code The route to get test code How to load File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project Code Project 9 Speaker Project 9 Speaker ...

Page 165: ... show icon and drag it into on start block Click the little triangle to find 2 Enter Music module to find and drug play sound giggle until done into forever block Enter Basic module to find and drug pause ms 100 into forever block Change 100 into 1000 3 Copy three times and place it into ...

Page 166: ...166 forever block Click the little triangle to select happy hello yawn ...

Page 167: ...167 Complete Program Select JavaScript and Python to switch into JavaScript and Python language code ...

Page 168: ...esults After uploading the test code to micro bit main board V2 and powering the board via the USB cable the speaker utters sound and the LED dot matrix shows the logo of music How to download How to quick download ...

Page 169: ...ton It contains a capacitive touch sensor that senses small changes in the electric field when pressed or touched just like your phone or tablet screen do When you press it you can activate the program 2 Experimental Preparation Connect micro bit to computer with the USB cable Open online Makecode editor Import Hex profile How to import Or click New Project and drag blocks step by step 3 Test Code...

Page 170: ... Speaker hex Or you could edit code step by step in the editing area 1 Delete block on start and forever 2 Enter Input module to find and drag on logo pressed Click the little triangle to find touched 3 Enter module Variables choose Make a Variable input start click OK The variable start is established Enter Variables module to find and drag set start to 0 into on logo ...

Page 171: ...nter Basic module to find and drag show icon into on logo touched block 6 Enter Input module to find and drag on logo pressed choose released establish variable time Enter Variables module to find and drag set time to 0 into on logo pressed block Enter Math module to find and drag 0 0 into the 0 of set start to 0 block ...

Page 172: ...es module to find and drag start into 0 on the right side of 0 0 8 Enter Basic module to find and drag show number into on logo released block Enter Math module to find and drag square root 0 into 0 Click the little triangle to find integer 9 Enter Variables module to find and drag time into 0 on the left ...

Page 173: ...173 side of 0 0 and change the 0 on the right side to 1000 Complete Program ...

Page 174: ...pt and Python language code 4 Test Results After uploading the test code to micro bit main board V2 and powering the board via the USB cable the LED dot matrix exhibits the heart pattern when the touch sensitive logo is pressed or touched and displays digit ...

Page 175: ...he microphone LED indicator turns on Since it can measure the intensity of sound you can make a noise scale or disco lighting changing with music The microphone is placed on the opposite side of the microphone LED indicator and in proximity with holes that lets sound pass When the board detects sound the LED indicator lights up 2 Experimental Preparation Connect micro bit to computer with the USB ...

Page 176: ...e Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 11 Microphone 1 Project 11 Microphone 1 hex Or you could edit code step by step in the editing area 1 Delete block on start and forever 2 Enter Input module to find and drag on loud sound Enter Basic module to find and drag show number into on loud sound block ...

Page 177: ...177 3 Copy once Click the little triangle of lond to choose quiet Click the little triangle of to choose Complete Program Select JavaScript and Python to switch into JavaScript and Python language code ...

Page 178: ...code to micro bit main board V2 and powering the board via the USB cable the LED dot matrix displays pattern when you claps and pattern when it is quiet around How to download How to quick download Code 2 The route to get test code How to load ...

Page 179: ...vanced module choose Serial to find and drag serial redirect to USB into on start block Enter Variables module choose Make a Variable input maxSound click OK variable maxSound is established Enter Variables module to find and drag set maxSound to 0 into on start block Enter Logic module to find and drag if true then else into forever block Enter Input module to find and dragbutton A is pressed int...

Page 180: ...drag show number into then Enter Variables module to find and drag maxSound into 0 Establish variable soundLevel Enter Variables module to find and drag set soundLevel to 0 into else Enter Input module to find and drag sound level into 0 ...

Page 181: ...vel into the 0 behind of Change the 0 behind up to 255 Enter Logic module to find and drag if true then into else block Enter Logic module to find and drag 0 0 into then Enter Variables module to find and drag soundLevel into 0 on the left side of 0 0 Enter Variables module to find and drag maxSound into 0 on the right side ...

Page 182: ...182 Enter Variables module to find and drag set maxSound to 0 into the second then Enter Variables module to find and drag soundLevel into the 0 ...

Page 183: ...183 Complete Program Select JavaScript and Python to switch into JavaScript and Python language code ...

Page 184: ...184 ...

Page 185: ...t code to micro bit main board V2 power the board via the USB cable and click Show console Device as shown below How to quick download When the sound is louder around the sound value shows in the serial port is bigger as shown below ...

Page 186: ...tton A the LED dot matrix displays the value of the biggest volume please note that the biggest volume can be reset via the Reset button on the other side of the board while when clapping the LED dot matrix shows the pattern of the sound ...

Page 187: ...with a variety of Bluetooth devices including smart phones and tablets In this project we mainly concentrate on the Bluetooth wireless communication function of this main board Linked with Bluetooth it can transmit code or signals To this end we should connect an Apple device a phone or an iPad to the board Since setting up Android phones to achieve wireless transmission is similar to that of Appl...

Page 188: ... 3 Procedures For Apple devices enter this link https www microbit org get started user guide ble ios with your computer first and then click Download pairing HEX file to download the Micro Bit firmware to a folder or desk and upload the downloaded firmware to the Micro Bit main board V2 ...

Page 189: ...189 ...

Page 190: ...190 ...

Page 191: ... Apple device with Micro Bit main board V2 Firstly turn on the Bluetooth of your Apple device and open the APP micro bit to select item Choose micro bit to start pairing Bluetooth Please make sure that the Micro Bit main board V2 and your computer are still linked via the USB cable ...

Page 192: ...192 Secondly click Pair a new micro bit ...

Page 193: ... A and B at the same time do not release them until you are told to and press Reset Power button for a few seconds Release the Reset Power button you will see a password pattern shows on the LED dot matrix Now release buttons A and B and click Next ...

Page 194: ...194 ...

Page 195: ...195 ...

Page 196: ...196 Set the password pattern on your Apple device as the same pattern showed on the matrix and click Next Still click Next and a dialog box props up as shown below Then click Pair ...

Page 197: ...197 A few seconds later the match is done and the LED dot matrix displays the pattern ...

Page 198: ...198 ...

Page 199: ...199 After the match with Bluetooth write and upload code with the App Click Create Code to enter the programming page and write code Click and the box appears and then select Create ...

Page 200: ...200 ...

Page 201: ...201 ...

Page 202: ...202 Name the code as 1 and click to save it ...

Page 203: ...203 Click the third item Flash to enter the uploading page The default code program for uploading is the one saved just now and named 1 and then click the other Flash to upload the code program 1 ...

Page 204: ...204 ...

Page 205: ...205 ...

Page 206: ...206 If the code is uploaded successfully a few seconds later the App will emerge as below and the LED dot matrix of the Micro Bit main board V2 will exhibit a heart pattern ...

Page 207: ...ith the help of external sensors of this turtle car Attention to avoid burning the the Micro bit main board V2 please remove the USB cable and the external power from the board before fix it with the shield of the car likewise the USB cable and the external power should be cut from the main board before disconnect the shield from the board ...

Page 208: ... level is input like a normal LED 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add ...

Page 209: ... Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 13 Colorful Lights 1 hex Project 13 Colorful Lights 1 hex Or you could edit code step by step in the editing area 1 Click MecanumRobot find and drag 指 to on start Copy once Click the little triangle behind Left to choose Right ...

Page 210: ...ompete Program Click JavaScript to view the corresponding JavaScript code run on start once to start the program open the colorful light on the left of the car open the colorful light on the right of the car ...

Page 211: ...211 Code 2 File Type Path File Name ...

Page 212: ...ject 13 Colorful Lights 2 hex Or you could edit code step by step in the editing area 1 click MecanumRobot to find and drag to forever Copy once Click the little triangle behind Left to choose Right 2 Click Basic to find and drag and tap the little triangle to choose 1 second Copy once and choose OFF ...

Page 213: ...hem in forever Complete Program In the forever instruction block the program runs cyclically Turn on the 2 colorful lights of the car Wait for 1 second Turn off the 2 colorful lights of the car Wait for 1 second ...

Page 214: ...oard and dial POWER switch to ON end 2 RGB lights of smart car emit red green blue indigo dark red yellow and white color cyclically Download code 2 to micro bit board 2 RGB lights show different color cyclically How to download How to quick download ...

Page 215: ... lesson 3 sets of test code are provided to make the 4 WS2812 RGB LEDs display different effects 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add Mecanum_...

Page 216: ...ou could edit code step by step in the editing area a Enter Neopixel set strip to Neopixel at pin P0 with 24 leds as RGB GRB format b Place it into on start block c Signal end P8 of WS2812 RGB is controlled by P8 of micro bit So we set to P8 d Smart car has 4 pcs WS2812 RGB lights so set to 4 leads Click Neopixel to move block strip clear into on start block ...

Page 217: ...sic to move pause ms 100 block into forever block Then set to 1000ms Copy code string for eight times and click red to respectively set to orange yellow green blue indigo violet purple and white Tap the triangle icon to select orange yellow green blue indigo violet purple and white ...

Page 218: ...218 Complete Code ...

Page 219: ...219 ...

Page 220: ... cyclically All RGB lights show red color Delay in 1000ms All RGB lights show orange color Delay in 1000ms All RGB lights show yellow color Delay in 1000ms All RGB lights show green color Delay in 1000ms All RGB lights show blue color Delay in 1000ms All RGB lights show indigo color Delay in 1000ms All RGB lights show violet color Delay in 1000ms All RGB lights show purple color Delay in 1000ms Al...

Page 221: ... Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 14 WS2812 RGB LEDs 2 hex Project 14 WS2812 RGB LEDs 2 hex a Enter Neopixel set strip to Neopixel at pin P0 with 24 leds as RGB GRB format ...

Page 222: ...icro bit So we set to P8 d Smart car has 4 pcs WS2812 RGB lights so set to 4 leads Click Loops to drag for index from 0 to 4 do into forever block Change 4 into 3 Click Neopixel to move block strip clear into block for index from 0 to 3 do Tap Neopixel more strip set pixel color at 0 to red ...

Page 223: ... into for index from 0 to 3 do block Click Variables to move index into 0 box 5 Click Neopixel to move strip show into for index from 0 to 3 do block 6 Tap Basic to move pause ms 100 block into index from 0 to 3 do ...

Page 224: ...224 Replicate code string for eight times and place them into forever block Click red to respectively choose orange yellow green blue indigo violet purple and white ...

Page 225: ...225 Complete Code ...

Page 226: ...f 4 pcs WS2812 RGB lights Set index of WS2812 RGB lights to red color Strip shows Delay in 100ms For index from 0 to 3 execute the program under do block Turn off 4 pcs WS2812 RGB lights Set index of WS2812 RGB lights to orange color Strip shows Delay in 100ms For index from 0 to 3 execute the program under do block Turn off 4 pcs WS2812 RGB lights Set index of WS2812 RGB lights to yellow color St...

Page 227: ...227 ...

Page 228: ...ndex of WS2812 RGB lights to indigo color Strip shows Delay in 100ms For index from 0 to 17 execute the program under do block Turn off all RGB on strip Set the index of WS2812 RGB lights to violet color Set all RGB lights to show violet color Strip displays all changes Delay in 100ms For index from 0 to 17 execute the program under do block Turn off all RGB on strip Set the index of WS2812 RGB li...

Page 229: ...hows Delay in 100ms For index from 0 to 3 execute the program under do block Turn off 4 pcs WS2812 RGB lights Set the index of WS2812 RGB lights to purple color Strip shows Delay in 100ms For index from 0 to 3 execute the program under do block Turn off 4 pcs WS2812 RGB lights Set the index of WS2812 RGB lights to white color Strip shows Delay in 100ms ...

Page 230: ...230 Click JavaScript to switch into the corresponding JavaScript code ...

Page 231: ... Makecode Tutorial Makecode Code Project 14 WS2812 RGB LEDs 3 hex Project 14 WS2812 RGB LEDs 3 hex Or you could edit code step by step in the editing area a Enter Neopixel set strip to Neopixel at pin P0 with 24 leds as RGB GRB format b Place it into on start block ...

Page 232: ...lights set to 4 leads Click Variables Make a Variable Input R to build up variable R We create variable G and B in same way Drag set B to 0 into on start block Copy set B to 0 twice and click triangle button to choose G and B Click Loops to get block for index from 0 to 4 do Leave it into forever and change 4 into 3 ...

Page 233: ...or index from 0 to 3 do block Click B to choose R Go to Math to drag block pick random 0 to 10 into 0 box Change 0 into 10 10 into 255 Replicate block twice and place them into for index from 0 to 3 do block Click R to select G and B ...

Page 234: ...ip set pixel color at 0 to red Leave it in the block for index from 0 to 3 do block Drag block red 255 green 255 blue 255 into red box Tap Variables to move index block into 0 box Separately drag R G and B into 255 box as shown below Click Basic to drag pause ms 100 under block strip B Set to 500ms ...

Page 235: ...235 Click Neopixel to move strip show block under pause as 500 ...

Page 236: ...236 Complete Code ...

Page 237: ...ads as RGB GRB format Set variable R to 0 Set variable G to 0 Set variable B to 0 The program under the block forever runs cyclically When the value of index is in 0 3 execute the program under do block Set variable R to random number in 10 255 Set variable G to random number in 10 255 Set variable B to random number in 10 255 Turn off all RGB on strip Set index of 4 pcs WS2812 RGB lights to RGB r...

Page 238: ...en have the function of automatic obstacle avoidance In the DIY process we need a servo to control the ultrasonic module to rotate left and right and then detect the distance between the car and the obstacle so as to control the car to avoid the obstacle If other microcontrollers are used to control the rotation of the servo we need to set a certain frequency and a certain width of pulse to contro...

Page 239: ...gnal with a period of 20ms and width of 1 5ms then compares the acquired DC bias voltage to the voltage of the potentiometer and obtains the voltage difference output For the servo used in this project the brown wire is the ground the red one is the positive wire and the orange one is the signal wire The rotation angle of servo motor is controlled by regulating the duty cycle of PWM Pulse Width Mo...

Page 240: ...ameters Working voltage DC 4 8V 6V Operating angle range about 180 at 500 2500 μsec Pulse width range 500 2500 μsec No load speed 0 12 0 01 sec 60 DC 4 8V 0 1 0 01 sec 60 DC 6V No load current 200 20mA DC 4 8V 220 20mA DC 6V ...

Page 241: ...ard into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add Mecanum_Robot extension 5 Test Code Code path File Type Path File Name ...

Page 242: ...ould edit code step by step in the editing area 1 Click Variables motor Make a Variable name create a variable named angle set the value to 0 and then put it into on start 2 Click Loops to find and drag to forever and change the number to 180 click MecanumRobot to find and drag and put variable angle into put into ...

Page 243: ...243 Click of Variable and of Math put variable angle on the left and change the umber on the right to 1 put it into Put behind and add delay in 10ms ...

Page 244: ...244 Copy once and change the of to Complete Program ...

Page 245: ...y once to start the program Set the initial value of the angle variable to 0 In the forever command box the program runs cyclically Cycle 180 times Rotate the servo to angle Angle variable increases 1 Delay in 10ms Cycle 180 times The servo rotates to angle Angle angle variable minus 1 Delay in 10ms ...

Page 246: ...246 6 Test Results After uploading the test code and dial POWER switch to ON end the servo rotates from 0 degree to 180 degrees How to download How to quick download ...

Page 247: ...uction motor which is developed on the ordinary DC motor It has a matching gear reduction box which provides a lower speed but a larger torque Furthermore different reduction ratios of the box can provide different speeds and torques Gear motor is the integration of gearmotor and motor which is applied widely in steel and machine industry ...

Page 248: ...it motor driver shield comes with PCA9685PW and TB6612FNG chip In order to save the IO port resource we control the rotation direction and speed of two DC gear motors with TB6612FNG chip Details about chips Front ...

Page 249: ...249 Back ...

Page 250: ...250 ...

Page 251: ...251 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end ...

Page 252: ... step add MecanumRobot extension library first How to add MecanumRobot extension 3 Test Code Code 1 File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 16 Motor 1 hex Project 16 Motor 1 hex Or you could edit code step by step in the editing area 1 Click MecanumRobot to find and drag into forever click the number ...

Page 253: ... little triangle behind Motor to choose Lower_left Upper_right Lower_right respectively and put them all in forever 2 Click Basic to find and drag pause ms 100 to forever set delay in 2000ms 3 Click MecanumRobot to find and drag to copy once and put it behind ...

Page 254: ...tate clockwise Set the speed of the rear left motor to 75 and the direction to rotate clockwise Set the front right motor speed to 75 and the direction to rotate clockwise Set the right rear motor speed to 75 and the direction to rotate clockwise The delay time is 2000 milliseconds 4 motors stop rotating Delay time 2000 milliseconds 4 motors stop rotating Delay time 2000 milliseconds ...

Page 255: ...255 Code2 Code path File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 16 Motor 2 hex Project 16 Motor 2 hex ...

Page 256: ...256 Or you could edit code step by step in the editing area 1 Drag and copy three times click the little triangle behind run to choose as shown ...

Page 257: ...Set the front right motor speed to 75 and th direction is reversed Set the right rear motor speed to 75 and th direction is reversed Wait for 2 seconds Set the front left motor speed to 75 and th direction is reversed Set the motor speed at the rear left to 75 and th direction is reversed Set the front right motor speed to 75 and th direction to rotate forward Set the right rear motor speed to 75 ...

Page 258: ...258 Click JavaScript to view the corresponding JavaScript code ...

Page 259: ...WER switch to ON end Smart car goes forward for 2s and stops for 2s Download code 2 to micro bit board the car goes forward for 2s turns back for 2s turn left for 2s turn right for 2s and stops for 2s and repeats this pattern How to download How to quick download ...

Page 260: ...00 IR tube has an IR emitting tube and a receiving tube Low level 0 is output when IR transmitting tube emits IR signals to receiving tube high level 1 will be output when smart car runs along black line When smart car drives on the white ground TCRT5000 IR tube will emit IR signals which will be reflected by white ground and received by receiving tube consequently output low level 0 on the contra...

Page 261: ...is controlled by the P1 and P2 of the micro bit The left TCRT5000 infrared pair tube on the sensor is controlled by P1 and the right one by P2 After putting a white paper on the bottom of the 4WD Mecanum Robot Car we rotate the two potentiometers on the 2 way tracking sensor When the indicator light on the sensor module is on pick up the car to make the two wheels on the 4WD Mecanum Robot Car sepa...

Page 262: ...add MecanumRobot extension library first How to add MecanumRobot extension 4 Test Code Code1 File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 17 1 Detect Line Tracking Sensor 1 Project 17 1 Detect Line Tracking Sensor 1 Or you could edit code step by step in the editing area Click Advanced Serial serial redirect to USB Place it into on start ...

Page 263: ...Move digital read pin P0 into 0 box The right tracking sensor is controlled by P14 Then change P0 into P14 and x into digital signal 2 Click Advanced Serial to find and drag t forever input left and drag it again Click MecanumRobot to find and drag to Copy once and change left to right ...

Page 264: ...264 Copy once and change Leftto Right Drag 3 Click Basic to find and drag pause ms 100 to forever and set delay in 200ms Complete Program ...

Page 265: ...ignals read by right line tracking sensors The on start command block runs only once to start program Serial redirection USB In the forever instruction block the program runs cyclically Write string left serially Serially write the output value of the tracking sensor on the le Serial write string right Serially write the output value of the tracking sensor on the ri Writing in line break Delay tim...

Page 266: ...266 Code 2 Code path File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 17 1 Detect Line Tracking Project 17 1 Detect Line Tracking Sensor 2 ...

Page 267: ...stablish variable LL To establish variable RR in the same way Find and drag set RR to 0 to on start Copy set RR to 0 once and place it to on start Click the little triangle behind RR to choose LL 3 Click Variables to find and drag set RR to 0 to forever Click the little triangle behind RR to choose LL Click MecanumRobot to find and drag to the 0 behind to Copy once and place it to forever 指 ...

Page 268: ... and Left to Right 4 Click Logic to find and drag if true then else to forever Click twice and find and drag an and to true Drag a to and 5 Click Variables to find and drag LL to the left side of the 0 on the right of remains unchanged ...

Page 269: ...py LL 1 once and place it to the right of and Click the little triangle behind LL to choose RR and change the 0 to 1 6 Click Basic to find and drag show leds to the first then Click the blocks to form pattern ...

Page 270: ...270 7 copy LL 0 and RR 1 once and place it behind the first else if change the first 0 to 1 and the first 0 behind LL to 1 others remain unchanged ...

Page 271: ...271 8 Click Basic to find and drag show leds to the second then Click the blocks to form pattern ...

Page 272: ...272 9 Copy LL 1 and RR 0 once and place it to else if and change the first number 1 behind LL to 0 ...

Page 273: ...273 10 Click Basic to find and drag show leds to the third else Click these blocks to form the pattern ...

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 276: ...nal read on th 1 0 When the variables LL 0 and RR 1 are esta execute the program under then The left side of the LED dot matrix displays the When the variables LL 1 and RR 0 are esta execute the program under then The pattern is displayed on the left of the L matrix When the variables LL 0 and RR 0 are esta execute the program under then The pattern is displayed on the left side of the matrix When...

Page 277: ...o bit LED dot matrix displays a pattern and the indicator light on the left side of the tracking sensor lights up When only the right TCRT5000 infrared pair tube on the sensor detects a white object the micro bit LED dot matrix displays a pattern and the indicator light on the right side of the tracking sensor lights up How to download How to quick download ...

Page 278: ...e micro bit board will analyze the signals and control smart car to show line tracking function 2 The Working Principle The smart car will make different moves according to the value received by the 3 channel line tracking sensor Left Right TCRT5000 IR Tunes Level 4WD Mecanum Ro bot Car LOW 0 HIGH 1 Turn Right HIGH 1 LOW 0 Turn Left HIGH 1 HIGH 1 Go forward ...

Page 279: ...itor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension Warning The 2 way tracking sensor should be used in environments without infrared interference such as sunlight Sunlight contains a lot of invisible light such as infrared and ultraviolet In an environment with strong sunlight the 2 way ...

Page 280: ... right one detects 0 Yes No Stop Both of sensors detect 0 Yes No Go forward 4 Test Code Code path File Type Path File Name Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 17 2 Line Tracking Smart Car hex Project 17 2 Line Tracking Smart Car hex Or you could edit code step by step in the editing area No need to create variable LL and RR but use ...

Page 281: ...281 and to decide Click Functions of Advance and then tap Make a Function change doSomething to car_forward car_back car_left car_right respectively ...

Page 282: ...282 ...

Page 283: ...283 Click Functions of Advance to find and drag to the first if and drag to the first else if Find and drag to the last else Click MecanumRobot to find and drag to the second else if ...

Page 284: ...284 Complete Program ...

Page 285: ... speed is 40 The front right motor reverses the speed is 40 The rear right motor reverses the speed is 40 Left turn function The front left motor reverses the speed is 60 The rear left motor reverses at a speed of 60 The front right motor rotates forward the speed is 85 The right rear motor rotates forward the speed is 85 right turn function The front left motor rotates forward the speed is 85 The...

Page 286: ...286 ...

Page 287: ... Download code to micro bit and dial POWER to ON end line tacking car goes forward along black line Note turn on the switch at the back of micro bit car the width of black line should be larger than the width of line tracking sensor Avoid to test smart car under the strong light ...

Page 288: ...nic sensor is being used in a wide range of electronics projects for creating obstacle detection and distance measuring application as well as various other applications As the above picture shown it is like two eyes One is transmitting end the other is receiving end The ultrasonic module will emit the ultrasonic waves after trigger signal When the ultrasonic waves encounter the object and are ref...

Page 289: ...t on the micro bit motor drive backplane The Trig T pin is controlled by P15 of the micro bit and the pin of Echo E the P16 2 Working Principle Pull down TRIG then trigger high level signals with least 10us After triggering the module will automatically send eight 40KHz ultrasonic pulses and detect whether there is a signal return ...

Page 290: ...ng current 15mA Working frequency 40khz Maximum detection distance about 3m Minimum detection distance 2 3cm Precision up to 0 2cm Sensing angle less than 15 degrees Input trigger pulse 10us TTL level Output echo signal output TTL level signal high proportional to range 4 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery hold...

Page 291: ...me Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 18 1 Ultrasonic Ranging hex Project 18 1 Ultrasonic Ranging hex Or you could edit code step by step in the editing area 1 Tap Advanced Serial serial redirect to USB Combine it with on start block 2 Click Advanced Serial to find and drag serial write value x 0 into forever Click MecanumRobot to find and drag Ultrasonic to the ...

Page 292: ...292 0 on the right side of serial write value x 0 and change the x on the left side of to distance 2 find and drag of Basic and change 100 to 200and place it behind Complete Program ...

Page 293: ...micro bit keep USB cable connected dial POWER switch to ON end The distance value will be displayed on monitor How to quick download The on start command block runs on Serial redirection USB In the forever instruction block the pr Serial write value distance Ultrasonic Delay time 200 milliseconds ...

Page 294: ...294 The monitor shows the distance between the obstacle and ultrasonic sensor as shown below When the distance is less than 10cm the passive buzzer of smart car emits sound ...

Page 295: ...ptions to select SerialPort Set COM port and 115200 baud rate the baud rate of USB serial communication of Micro bit is 115200 through the test Click OK and Connect CoolTerm serial monitor displays the distance value as follows ...

Page 296: ...296 ...

Page 297: ...ansion board to make an ultrasonic avoidance car Its principle is to detect the distance between the car and obstacle by ultrasonic sensor and control the motion of smart car 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable ...

Page 298: ...298 Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension 3 Flow Chart ...

Page 299: ...ance 20cm YES Go forward STOP NO Servo rotates to the left and obtains the left distance Left distance Right distance Servo rotates to the right and obtains the right distance Servo rotates 90 turn left YES NO Servo rotates 90 turn right 4 Test Code Code path ...

Page 300: ...asonic Avoidance Car hex Or you could edit code step by step in the editing area 1 Enter Basic show icon Place it into on start and click the triangle button to select pattern 4 Click Variables and then click Make a Variable dialog box New variable name pops up Fill it with distance Click OK to establish variable distance Set the functions of servo ...

Page 301: ...k MecanumRobot to find and drag Ultrasonic to the 0 behind the to 6 Click Logic to find and drag if true then else to forever Find and drag to true Click Variables to find and drag distance on the left of Click the little triangle behind to choose Change the 2 behind to 20 ...

Page 302: ...302 7 Click Funtionsto of Advance to find and drag Click MecanumRobot to find and drag to then Click Basic to find and change the 100 to 500 ...

Page 303: ...303 8 Click MecanumRobot to find and drag and change the 0 to 180 Copy once Click Variables to find and drag set distance_l to 0 Click MecanumRobot to find and drag Ultrasonic to 0 behind to Copy once ...

Page 304: ...304 9 Copy once Change the 180 to 0 distance_l to distance_r and others remain unchanged ...

Page 305: ...0 Click Logic to find and drag if true then else Find and drag to true Click Variables to find and drag distance_l to the left of Click the little triangle behind to choose Change the 0 behind to distance_r ...

Page 306: ...306 11 Click Funtionsto of Advance to find and drag Click MecanumRobot to find and drag Change the 0 to 90 Click Basic to find and drag and change the 100 to 300 ...

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 312: ...ults Download code to micro bit dial to ON end and dial POWER to ON end When the obstacle distance is greater than 20cm the car goes forward on the contrary smart car turns left How to download How to quick download ...

Page 313: ... Next we will combine ultrasonic sensor with car shield to make an ultrasonic follow car The ultrasonic sensor detects the obstacle distance and control the motion status of car 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end ...

Page 314: ... to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension 3 Flow Chat ...

Page 315: ...0cm 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 ...

Page 316: ...lect pattern 2 Click MecanumRobot to find and drag to on start and change the angle 0 to 90 1 Click Variables and then click Make a Variable the dialog box New variable name pops up fill it with distance Click OK to establish variable distance Drag set distance to 0 to forever Click MecanumRobot to find and drag to the 0 of set distance to 0 ...

Page 317: ... if true then else to forever Find and drag to true Click Variables to find and drag distance to the left side of Click the little triangle behind to choose Change the 0 behind to 10 5 Click Funcions of Advance to find and drag to then ...

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 321: ...321 5 Test Results Download code to micro bit dial POWER switch to ON end on shield smart car could follow the obstacle to move How to download How to quick download ...

Page 322: ...atellite signal receivers Infrared remote control is composed of infrared transmitting and infrared receiving systems that is an infrared remote control and infrared receiving module and a single chip microcomputer capable of decoding The 38K infrared carrier signal emitted by remote controller is encoded by the encoding chip in the remote controller It is composed of a section of pilot code user ...

Page 323: ...g what key is pressed by the remote control Infrared receiver we use is an infrared receiver module Mainly composed of an infrared receiver head it is a device that integrates reception amplification and demodulation Its internal IC has completed demodulation and can achieve from infrared reception to output and be compatible with TTL signals Additionally it is suitable for infrared remote control...

Page 324: ...t micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension 4 Test Code File Type Path File Name ...

Page 325: ...trol hex Click Advanced Serial serial redirect to USB Place it into on start block Enter IrRemote connect IR receiver at P0 Put it into on start block IR receiving module is controlled by P9 of micro bit board so click P0 to select P9 Go to Variables Make a Variable New variable name dialog box Enter val and click OK to create variable val ...

Page 326: ...r Remote IR button Place it into 0 box Click Advanced Serial serial write value x 0 Put it into forever block Change x into IR Enter Variables to move block val into 0 box behind Drag out block pause ms 100 from Basic and delay in 1000ms Leave it into forever block ...

Page 327: ...nto the corresponding JavaScript code on start command block runs once to start program Serial redirect to USB Connect IR receiver to P9 The program under the block forever runs cyclically Set val to IR button Serial port prints IR val Delay in 1000ms ...

Page 328: ...ve of batteries We recommend you to purchase them online battery type CR2025 Make sure IR remote is good before test There is a tip for you to check it Open the cellphone camera make IR remote control point at camera and press button The remote control is good if you see the purple flashing light in the camera Download code to micro bit board and don t plug off USB cable Click How to quick downloa...

Page 329: ...329 Make IR remote control point at IR receiver and press the button the serial monitor will display the corresponding key values as shown below ...

Page 330: ...330 Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate Click OK and Connect CoolTerm serial monitor shows the key value as follows ...

Page 331: ...331 The key value is displayed as for your reference ...

Page 332: ...332 19 2 IR Remote Control ...

Page 333: ... into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension Note The infrared sensor and infrared remote control should not be used in environments with infrared interference such as...

Page 334: ...3 Flow Chart Start IR receiver detects new signals and save in val2 Val2 70 YES Go forward NO Val2 68 Turn left YES NO Val2 67 Turn right YES NO Val2 21 Go back Val2 64 NO YES Stop YES 4 Test Code Code path ...

Page 335: ...trol hex Project 19 2 IR Remote Control hex Or you could edit code step by step in the editing area 1 Create four functions controlling the car to move forward and back and turn left and right 2 Click Ir Remote to find and drag connect IR receiver at P0 into on start Click the little triangle behind P0 to choose P9 ...

Page 336: ...find and drag set val2 to 0 to on start and copy it once to put into on start too Click the little triangle behind the first val2 to choose val 4 Click Variables to find and drag set val2 to 0 to forever Click the little triangle behind val2 to choose val Click IrRemote to find and drag IR button to the 0 behind to 5 Click Logic to find and drag if true then into forever find and drag ...

Page 337: ... remain unchanged click the little triangle behind to choose 6 Click Variables to find and drag set val2 to 0 into then find and drag val into the o behind to of set val2 to 0 7 Click Logic to find and drag if then else to then Click of if then else four times Click behind else once to delete else ...

Page 338: ...338 Find and drag to true 8 Click Variables to find and drag val2 to the left side of and change the 0 on the right of to 70 ...

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 342: ...342 second then 2 Copy val2 68 once and place it behind the second else if change the 68 behind to 67 place it in the forth then Click Functions of Advance to find and drag to the forth then ...

Page 343: ...343 13 Copy val2 67 once and put it behind of the third else if change the number 67 to 21 click Functions of Advance to find and drag to the fifth then ...

Page 344: ...344 14 Copy val2 21 once and place it behind the fourth else if change the the number 21 behind to 64 Click MecanumRobot to find and drag to the sixth then ...

Page 345: ...345 Complete Program ...

Page 346: ...ble val2 to 0 In the forever instruction b Set val to IR button When the variable val 0 program under then Set variable val2 to val When val2 70 is established then The car goes forward When val2 68 is established then Turn left When val2 67 is established then Car turn right When val2 21 is established then The car goes back When val2 64 is established then The car stops ...

Page 347: ...ON end Make IR remote control point at micro bit and press the button to control smart car to move button makes smart car move forward stands for turning left implies rightward turning indicates moving backward stops car and 4pcs WS2812RGB light up the corresponding color ...

Page 348: ...ion Micro bit main board comes with a built in Bluetooth which can be used to communicate with it And the Micro bit can also be controlled by Bluetooth or transmit signals back to smartphone or computer via it This Bluetooth can communicate with the Bluetooth equipped in other devices or with Bluetooth App to control other equipment It is compatible with both Android system ans IOS system And we h...

Page 349: ...r Place batteries into battery holder Dial power switch to ON end Connect micro bit to computer by USB cable Open online Makecode editor Import Hex profile How to import or click New Project and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension As the Bluetooth and extension radio can t work together therefore their extension libraries are not comp...

Page 350: ...x file KS4031 4032 folder Makecode Tutorial Makecode Code Project 20 1 Read Bluetooth Data hex Project 20 1 Read Bluetooth Data hex Or you could edit code step by step in the editing area Enter Advanced Serial serial redirect to USB Place it into on start ...

Page 351: ...riable New variable name dialog box Input connected and click OK to create variable connected Drag set connected to 0 under block show icon and change 0 into 1 Go to Loops to move block while true do into on bluetooth connected block Enter Logic to drag out block Click Variables to drag connected into left box of block and change 0 into 1 ...

Page 352: ...ut set rec_data to 0 and place it into block while connected 1 do block Click Bluetooth more bluetooth uart read until new line Keep it into 0 box and click triangle button to select Go to Advanced Serial serial write string Move it below set rec_data until block ...

Page 353: ...353 And combine variable rec_data with serial write string block Click Advanced Serial serial write line and edit code string as follows ...

Page 354: ...uetooth to drag out on bluetooth disconnected Go to Bluetooth on bluetooth disconnected Copy show icon block and keep it into block on bluetooth disconnected Click triangle button to select pattern Complete Program ...

Page 355: ...355 ...

Page 356: ...program Serial redirect to USB Connect Bluetooth LED dot matrix shows pattern Set variable connected to 1 When connected 1 the code under do block will be executed Set rec_data to bluetooth uart read until Serial port prints rec_data Print a blank space Disconnect Bluetooth LED dot matrix displays pattern ...

Page 357: ...ou need to set as follows after finishing test code Click However you could skip this step if you directly import test code After setting download code to micro bit board don t plug off USB cable How to download How to quick download Next to download App ...

Page 358: ...the mobile phone iPad and then click the connect button control in the upper left corner of the APP interface to perform a Bluetooth search In the search results click BCC micro bit After a few seconds the Bluetooth is connected For Android System a Use the scanning function in the browser to scan and identify the QR code or enter the http 8 210 52 206 mecanum_robot apkto download After the identi...

Page 359: ...stall the App C Click Open or click the application mecanum_robot on the mobile phone desktop to open the APP and a dialog box appears In the dialog box click Allow to turn on the Bluetooth of the mobile phone You can also turn on the phone s Bluetooth before opening the APP ...

Page 360: ... the upper right corner to search for Bluetooth and click connect a few seconds later the Bluetooth is paired Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate Click OK and Connect ...

Page 361: ...361 Point at micro bit board and press the icons on APP the corresponding characters are shown on CoolTerm monitor Through the test we get the function of every icon as shown below ...

Page 362: ...362 ...

Page 363: ...r 1 Project Description In this lesson we will control the smart car to perform multipurpose function 2 Experimental Preparation Insert micro bit board into slot of keyestudio 4WD Mecanum Robot Car Place batteries into battery holder ...

Page 364: ...and drag blocks step by step add MecanumRobot extension library first How to add MecanumRobot extension As the Bluetooth and extension radio can t work together therefore their extension libraries are not compatible Therefore remove extension s and add Bluetooth please if you see the following prompt box pop up 3 Test Code Code path File Type Path File Name ...

Page 365: ...365 Hex file KS4031 4032 folder Makecode Tutorial Makecode Code Project 20 2 Multi purpose Smart Car hex Project 20 2 Multi purpose Smart Car hex Complete Code ...

Page 366: ...366 ...

Page 367: ...367 Click JavaScript to view the corresponding JavaScript code ...

Page 368: ... This experiment combines the previous projects to make the car to perform actions by Bluetooth Enter Makecode online editor Projecting Settings enable No Pairing you could skip this step if you import test code directly ...

Page 369: ...ces Download PDF files https fs keyestudio com KS4031 4032 BBC microbit MicroPython https microbit micropython readthedocs io en latest tutorials introducti on html MicroPython https docs openmv io reference index html ustruct library https docs openmv io library ustruct html math library https docs openmv io library math html utime sleep_us tick_us library https docs openmv io library utime html ...

Reviews: