DFRobot BOSON Starter Manual

Micro:bit kit
Hide thumbs Also See for BOSON:
Table of Contents

Advertisement

Quick Links

Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html
1 / 115

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BOSON and is the answer not in the manual?

Questions and answers

Summary of Contents for DFRobot BOSON

  • Page 1 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 1 / 115...
  • Page 2: Table Of Contents

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 2 / 115 Content Chapter 1: Mind+ and micro: bit ......................6 1. Introduction to Mind+ ........................7 1.1 Download and Install Mind+ ..................... 7 1.2 Mind+ Interface .......................... 10 2. Micro: bit ............................12 3.
  • Page 3 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 3 / 115 1.Story of Micko and Dr.M ......................41 2.Dr.M's Pocket ..........................42 3.Dream of Micko: Push-button Fan ..................42 4.Dr.M's Blackboard ........................43 5.Dream of Micko: Set the fan running at different speed ..........46 6.Dr.M's Blackboard ........................
  • Page 4 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 4 / 115 Project 4: Colorful LED Strip ......................69 1.Story of Micko and Dr.M ......................69 2.Dr.M's Pocket ..........................70 3.Dream of Micko: Turn on the RGB LED strip ............... 70 4.Dr.M's Blackboard ........................71 5.Dream of Micko: Turn on the rainbow LEDs ..............
  • Page 5 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 5 / 115 3.Dream of Micko ........................104 4.Dr.M's Blackboard ........................105 5.Invention of Micko ........................113...
  • Page 6: Chapter 1: Mind+ And Micro: Bit

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 6 / 115 Chapter 1: Mind+ and micro: bit Hello, Dr.M. More and more people are learning to code and their works are so funny. And I also want to design my own works! Well? Sweetie, what kind of works do you prefer? I wanna make a light sensitive lamp.
  • Page 7: Introduction To Mind

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 7 / 115 1. Introduction to Mind+ With so many different graphical Programming software products on the market, how can you get the right one? It may disappoint you when you found that your software only supports some certain hardware and robots or even cannot work with any hardware at all.
  • Page 8 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 8 / 115 STEP2: Install Driver After downloaded and installed the software, open and click “Learning” to learn how to install driver. 1. Click to open Learning ->Video Tutorials. Click the video tutorials to get started Figure1.1.2 Video Tutorials...
  • Page 9 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 9 / 115 STEP3: Switch to “Code” mode (The tutorial is based on “Code” mode). 1. Click “Code” icon at the right corner to switch mode. 2. Switched to ”Code” mode successfully. Click icon“Code”...
  • Page 10: Mind+ Interface

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 10 / 115 1.2 Mind+ Interface To convenient the operation, first we should be familiar with the basic functions of the software’s interface. If we compare the Mind+ software as a stage, what are the functions of its different sections?
  • Page 11 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 11 / 115 Command: This is the “tool section” of the stage. We need all kinds of tools to give an excellent performance on the stage, and we can get more extra tools in “Extensions” to support different hardware.
  • Page 12: Micro: Bit

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 12 / 115 2. Micro: bit Micro: bit is an open source hardware ARM-based embedded system designed by the BBC. It has accelerometer, magnetometer, Bluetooth, three buttons and a display consisting of 25 LEDs.
  • Page 13 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 13 / 115 The advantages of micro: bit expansion board 1. micro: bit expansion board can easily lead out the extra pins of micro: bit, plug and play, easy to use; 2. The expansion interfaces of micro: bit improve the safety and stability of connection.
  • Page 14: Get Started With Mind+ And Micro: Bit

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 14 / 115 3. Get Started with Mind+ and micro: bit Please prepare a Windows computer and components as below before we get started: Figure 1.3.1 micro: bit Figure1.3.2 micro USB connector STEP1: Select micro: bit 1.
  • Page 15 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 15 / 115 1. Drag the blocks we do not need currently to “command area” to remove it. Drag the blocks we do not need currently to “command area” to remove it. Figure1.3.6 Remove Blocks 2.
  • Page 16 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 16 / 115 STEP3: Upload to device 1. Connect micro: bit board to your computer via USB, then the power indicator on the board will light up. micro: bit to computer Figure 1.3.9 Connect 2.
  • Page 17 Welcome to our DFRobot Community to find more tutorials and fantastic projects, and of course you can also share your own projects or ideas on our community. Looking forward to your log in!
  • Page 18: Chapter 2: What Makes A Machine "Come To Life

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 18 / 115 Chapter 2: What Makes a Machine “Come to Life” After reading the previous introduction, are you itch to have a try? Now, let’s begin our journey with micro: bit! Project 1: The Mysterious micro: bit 1.Story of Micko and Dr.M...
  • Page 19: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 19 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro USB Cable All necessary components are in the pocket of Dr.M. 3.Dream of Micko There are 25 LEDs on board. And I want to control all LEDs and show different forms.
  • Page 20 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 20 / 115 STEP2:Programming 1) Open Mind+ software, click Project->New Project, and then select “micro: bit” board from “Extensions” Let’s review the steps to select “micro: bit” board: (1) Click “Extensions” at the lower-left corner (2) Click “Board”...
  • Page 21 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 21 / 115 Ah ha? Dr.M, Why should we delete the block forever? So, when will we use it? Sweetie, the block forever (loop) is very important. It is used to execute the code more than once at least.
  • Page 22: Design Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 22 / 115 6) Click “Upload” to upload the program to micro: bit board. Then, you will find a “heart” on micro: bit LED panel. Remember to connect the device before you “Upload”: Click “Connect Device”...
  • Page 23: Project2: Flash The Led Light

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 23 / 115 Project2: Flash the LED Light 1. Story of Micko and Dr.M Dr.M, the lovely little heart made last week is very interesting, my classmates love it! My dear, not just emojis, playing mind+ and micro: bit can make as much as you can imagine.
  • Page 24: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 24 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× LED Module 1× micro USB Cable 3.Dream of Micko: Light up LEDs The LED is OFF, I want light it ON. What should I do? 4.Dr.M's Blackboard...
  • Page 25 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 25 / 115 Note: the following projects we will learn are based on the combined use of micro: bit board and micro: bit expansion board. Dr.M, Why should we use these two boards together? Could we only use the main...
  • Page 26 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 26 / 115 Figure 2.2.4 Set Digital Pin Dr.M, I am confused. May I ask you some questions? Okay, take it easy. If you have any questions, feel free to ask me. The 1st question: Why should we change...
  • Page 27 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 27 / 115 Set the pin LOW to turn off LED Set the pin HIGH to turn on LED Well, the high level is corresponding to light ON LED, and the low level is corresponding to light OFF LED.
  • Page 28: Dream Of Micko: Flash The Led Light

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 28 / 115 3. Result: the LED will be on when the code is uploaded successfully. Keep on Figure 2.2.6 Result 5.Dream of Micko: Flash the LED Light Now I learned how to light...
  • Page 29 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 29 / 115 Dr.M, I remember! Here we can use “forever” (loop) to keep execute the program. Good memory! Yes, the loop block is used to execute program again ‘if…then’ and again. 3) Place “wait 1 sec” block under the “set digital pin P1 output HIGH” block so as to let the LED keep on for 1 second then do the next action.
  • Page 30: Design Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 30 / 115 Cool! Click the right mouse can duplicate the blocks. It is very convenient! 5) Place the duplicated blocks under the block “wait 1 sec”, change “HIGH” “LOW” to let the LED keep off for 1 second. Since we used forever statement here, the program of LED flashing will be running all the time.
  • Page 31 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 31 / 115 My Design My Program...
  • Page 32: Project 3: Notification Light

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 32 / 115 Project 3: Notification Light 1.Story of Micko and Dr.M Dr.M, I will flying to DF Starship with my friends this week, but I am a little afraid of dangers. Eh, it will cost several hours at plane.
  • Page 33: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 33 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× LED Module 1× micro USB Cable 1× Push Button 1× Knob Know something about Push-button and Switch Knob: Push-button is the common button we can find on lamp. By programming, we can realize to turn on/off the LED through the Push-button.
  • Page 34: Dream Of Micko: Control Led By Push Button

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 34 / 115 Dr.M, is that Input inputs signals? So clever! You are right. For an example, in the project LED control via the Push Button, the Push Button is a input and the LED is a output.
  • Page 35 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 35 / 115 STEP2: Programming 1) Click “micro: bit” module, find “read digital pin P0” block and drag it to script area. Figure 2.3.2 read digital pin P0 block Dr.M, why not use high level and low level at here? Sweetie, because we need to check the P0 value to judge whether the Push Button is pressed.
  • Page 36 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 36 / 115 Figure 2.3.3 “=” Block Dr.M, how to judge whether the Push Button is pressed? Good question! We can judge it by the condition judgement command “if…then…else”. But how? Go on reading and you will see.
  • Page 37 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 37 / 115 4) Nest the conditions of equation into the “if then…else” block as shown below: Figure 2.3.5 Nest Blocks 5) Find the block “set digital pin P0 output LOW” in the “micro: bit”...
  • Page 38: Dream Of Micko: Control Led By Knob

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 38 / 115 5.Dream of Micko: Control LED by Knob Sometimes, the light is too bright. Could I use the Rotation to control the brightness? 6.Dr.M's Blackboard STEP1: Replace the push-button module in the last project with switch knob module.
  • Page 39 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 39 / 115 The brightness of LED is decided by the value of the analog pin (knob’s angle). Switch the knob to control the LED’s brightness. Micro: bit “read analog pin” (knob) ranges from 0 to 1023, so does the output analog pin.
  • Page 40: Design Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 40 / 115 7.Design of Micko My dear, can you design a beautiful and practical rotation light now? My Design My Program...
  • Page 41: Project 4: Electric Fan

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 41 / 115 Project 4: Electric Fan 1.Story of Micko and Dr.M Dr.M, DF Starship is so interesting! With the inertia, we are floating in the outer space. I have seen lights and shades from the portholes.
  • Page 42: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 42 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Fan Module 1× micro USB Cable 1× Push Button 1× Knob The fan is similar to household fan, inside of which has motors and blades.
  • Page 43: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 43 / 115 4.Dr.M's Blackboard STEP1: Connect the push-button module to pin P0 of the expansion board; connect the fan module to pin P1. Figure 2.4.1 Connection Diagram Let’s see how to use the fan module: Connect micro: bit with computer, debug and download your programs.
  • Page 44 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 44 / 115 STEP2: Programming Click “micro: bit” module, select “read digital pin P0”, and drag it to script section. Figure 2.4.2 “read digital pin” 2. The “=” in the “Operators” module can be used to judge whether the button is pressed.
  • Page 45 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 45 / 115 4. Nest the conditions of equation into the “if then…else” block as shown below. Figure 2.4.5 Nest Blocks 5. Find the block “set digital pin P0 output LOW” in the “micro: bit”...
  • Page 46: Dream Of Micko: Set The Fan Running At Different Speed

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 46 / 115 5.Dream of Micko: Set the fan running at different speed The Push Button fan blows too fast, I want to control the rotating speed. Can I make the fan running at different speed? 6.Dr.M's Blackboard...
  • Page 47 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 47 / 115 Drag the “set analog pin P0 output” of the micro: bit module to the “forever” in the script area, revise P0 to P1, and nest the two blocks as shown below.
  • Page 48: Design Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 48 / 115 7.Design of Micko The summer is coming, do you want to make a cool fan lamp? Then you can enjoy the cold wind more comfortable. Tip: How to use 1 micro: bit to control LED and fan at the same time? Well, we can try other pins.
  • Page 49: Chapter 3: Get Hands On

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 49 / 115 Chapter 3: Get hands on! Except the push-button and switch knob module we learned before, there are more commonly-used sensors. Use them to make more smarter, funnier and useful projects. Come and learn!...
  • Page 50: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 50 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× LED Module 1× Sound Sensor 1× micro USB Cable Let’s get to know about sound sensor: Sound sensor can sense the intensity of sound. After programming, it can be used to turn on/off the LED through the sound intensity.
  • Page 51: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 51 / 115 How to design the project? When the analog value of sound intensity is less than 80, we set the on-board LED display the figure “1”, which means that the sound is low and intensity is grade 1.
  • Page 52 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 52 / 115 Figure 3.1.2 “if…then…else” Figure 3.1.3 “<” 2. Read the analog value(0~1023) of “read analog pin P0” that connected with sound sensor to detect the sound of intensity. 3. Edit the programs to realize “sound intensity detecting”.
  • Page 53: Dream Of Micko: Micro: Bit Candle

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 53 / 115 5.Dream of Micko: micro: bit Candle Can I make the micro: bit a candle? When I do not blow, it keeps ON, and when I blow the LED is OFF. 6.Dr.M's Blackboard Control the LED to turn on/off according to the value of the pin connected to the sound sensor.
  • Page 54: Creation Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 54 / 115 2. Programming to make a “electronic candle” When the analog value of sound sensor is less than the preset value 80, the LED keeps on, otherwise, blow it like a candle, when the sound intensity is over 80, the LED keeps off for 2 seconds.
  • Page 55: Project 2: Automatic Door

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 55 / 115 Project 2: Automatic Door 1.Story of Micko and Dr.M Dr.M, it is so funny to make that e-candle last week. There are so many interesting gismos in our life. Yes, my dear, it’s not the lack of joys in life, but the lack of the eyes to find joys.
  • Page 56: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 56 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Push Button 1× micro USB Cable 1× Motion Sensor 1× Servo First time to see Motion sensor and servo module, let’s take a look:...
  • Page 57: Dream Of Micko: Control Servo With Push Button

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 57 / 115 3.Dream of Micko: Control Servo with Push Button I want to use the Push Button to control the servo, press the button and the servo rotates 100°. Release the button, the servo rotates 0°.
  • Page 58 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 58 / 115 Figure 3.2.2 Extensions Figure 3.2.3 Actuator->Micro Servo STEP2: Programming 1. Drag “set pin P9 servo to…degree” block in “actuator” module. Change P9 to P0. Set pin P0 to control servo’ s value.
  • Page 59 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 59 / 115 2. Set: if the button is pressed, the servo rotates for 100 degree and the LED display “o”. Otherwise, the servo rotates for 0 degree and the LED display “×”. Here we need to use “if…then…else”...
  • Page 60: Dream Of Micko: Control The Servo With Motion Sensor

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 60 / 115 Result Figure 3.2.7 Result-Loosen Figure 3.2.8 Result-pressed 5.Dream of Micko: Control the Servo with Motion Sensor I want to make a mini control device of automagical door. servo rotates 100° someone passed, otherwise rotates 0°.
  • Page 61 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 61 / 115 Figure 3.2.10 “read digital pin” 2. When the motion sensor detected that there is people passing by, the servo rotates for 100 degrees; otherwise, it rotates 0 degree. We need “if…then…else”...
  • Page 62: Creation Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 62 / 115 Result Unoccupied Occupied Figure 3.2.13 No one passed by Figure 3.2.14 When people passed by 7.Creation of Micko What a magic device! I know the way to control a door now.
  • Page 63: Project 3: Music Box

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 63 / 115 Project 3: Music Box 1.Story of Micko and Dr.M Dr.M, except robot class, do you know which class is my favorite? Let me guess, probably music? The beautiful and lovely sounds are always attractive.
  • Page 64: Dream Of Micko: Play Music

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 64 / 115 1× Earphone 1× Motion Sensor 1× micro USB Cable 3.Dream of Micko: Play Music My wish is to make micro: bit play music! 4.Dr.M's Blackboard STEP1: connect micro: bit board to computer with USB cable, plug the earphone in the expansion board;...
  • Page 65 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 65 / 115 STEP2: Programming “pin P0 play sound…until done” 1. Drag block from “micro: bit” module to script area. There are many built-in sounds to choose. We select the “dadadadum” sound here. Figure 3.3.2 Command “pin P0 play sound…until done”...
  • Page 66: Dream Of Micko: Smart Music Box

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 66 / 115 Ha-ha, this is just a tip of the iceberg. You will find more interesting functions. 5.Dream of Micko: Smart Music Box I will play my own music in micro: bit. How cool if it can...
  • Page 67 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 67 / 115 “pin P0 play note-C2 for 1beat” 2. Drag from the “micro: bit” module to “C2” script area. Revise the parameter to play different notes, and ”1” change the parameter to adjust the beat.
  • Page 68: Creation Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 68 / 115 Figure 3.3.7 Run the Program 7.Creation of Micko My friend, do you what to make your own music box? Get thinking and making one! My Design My Program...
  • Page 69: Project 4: Colorful Led Strip

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 69 / 115 Project 4: Colorful LED Strip 1.Story of Micko and Dr.M Dr.M, the last music box is so cool! But… Yes? Any questions? Dr.M, I want to make a good-looking shell. How fantastic if the shell can shining like stars and dancing with the music.
  • Page 70: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 70 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Sound Sensor 1× Colorful LED Strip 1× micro USB Cable First time to see LED strip, come to meet her:...
  • Page 71: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 71 / 115 4.Dr.M's Blackboard STEP1: Connect the LED strip to pin P0 of the expansion board. Figure 3.4.1 Connection Diagram STEP2: Expansions->Display->WS2812 Add the LED strip command module. Click RGB LED Strip, then back to the former interface.
  • Page 72 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 72 / 115 STEP3: Programming “display” 1. Click module in the left to present the LED strip commands. Figure 3.4.4 “WS2812 RGB LED Strip” blocks There are so many blocks at here. I feel a little dizzy.
  • Page 73 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 73 / 115 Dr.M, why 0 stands for 1 LED? Why we do not use 1 to represent 1 LED? Big question! This is because the Arabic numerals are beginning with 0. So we always use 0 as the first one, so the 1 LED is represented by 0.
  • Page 74: Dream Of Micko: Turn On The Rainbow Leds

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 74 / 115 5.Dream of Micko: Turn on the rainbow LEDs Can we light ON 1 LED in every second? 6.Dr.M's Blackboard Sweetie, the way to realize this effect is a little harder. You need to think more and be more patient.
  • Page 75 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 75 / 115 Figure 3.4.7 Create a new Variable Figure 3.4.8 Name the Variable First time to create a variable, let’s get to know: After we created the variable, the blocks of “the name of the variable”,...
  • Page 76 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 76 / 115 turn off and start from the beginning. The flow chart below may help us to figure out what the program looks like: Figure 3.4.10 Flow Chart Sweetie, it is worth thinking about the flow chart.
  • Page 77 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 77 / 115 “the number of LEDs to be lit”( α ) 5. If is less than 6, light up LEDs, wait 1 α second, then make the parameter getting larger by 1, which means to make one more LED light up.
  • Page 78: Dream Of Micko: Rgb Led Strip Controlled By A Sound Sensor

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 78 / 115 7.Dream of Micko: RGB LED strip controlled by a sound sensor Huh? Can we light ON only 1 when make sound? When all 7 LEDs are lighted, light OFF all LEDs and repeat light ON one by on again? 8.
  • Page 79 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 79 / 115 Figure 3.4.15 “read analog pin P0” STEP3: “the number If the sound value the sensor detected exceeds 40 and the of LEDs to be lit” αis less than 6, control the LED strip to light upαLEDs. Then the sensor will be constantly detecting the sound value.
  • Page 80: Creation Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 80 / 115 STEP4: Programming Based on the program of the last project, we need to add a “if…then” “the number of LEDs to statement to judge the sound value. That is to say, when be lit”α≤6,if...
  • Page 81: Chapter 4: Become An Expert

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 81 / 115 Chapter 4: Become an expert We have built so many funny works with different types of modules in previous chapters. You may now have a deeper understanding of the micro: bit. Is that enough for the exploration? The answer is doubtlessly NO! Hang on there and we will take another further step into the micro: bit.
  • Page 82: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 82 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Servo 1 × micro USB Cable 3.Dream of Micko How could I make a servo pointer keeps vertical matter how to rotate?
  • Page 83 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 83 / 115 What is gravity? It is the force that attracts an object toward the center of the earth, or toward any other physical object having mass. What is acceleration of gravity? The magnitude of the acceleration due to gravity, denoted with a lower-case g, is 9.8 m/s...
  • Page 84: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 84 / 115 When the micro: bit board lays flat on the desktop, gravitational force goes along up-and-down direction (Z axis), so that the values of X and Y are close to zero. When we tilt the board, the value of X axis changes. When it leans to the left, its value is negative, conversely, positive.
  • Page 85 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 85 / 115 Figure 4.1.4 “read acceleration” 2. The output value of the accelerometer ranges between -1023 and 1023, and we can use “display” block to check it. Figure 4.1.5 “display” the acceleration value Figure 4.1.6 Result...
  • Page 86 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 86 / 115 Here we have to use “map” function. Mapping the value of accelerometer’s X axis (-1023~1023) onto the degree that the servo rotates (0~180 degree). After mapping, when the board lays flat on the desktop, the angle of the servo will be 90 degrees.
  • Page 87: Invention Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 87 / 115 5. Drag “set pin servo to… degree” block to script area, and put it inside the “forever” block, then nest the “map…” block into it. Shown as below: Figure 4.1.9 Run the Programs 6.
  • Page 88 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 88 / 115 The servo of micro: bit ranges from 0~180°, while the compass need to “display” “read compass rotate from 0~360°,so we can directly use orientation” to get the position. Read the operation instruction of micro: bit...
  • Page 89: Project 2: Dj Panel

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 89 / 115 Project 2: DJ panel 1.Story of Micko and Dr.M Christmas is coming, what kind of program will you perform? Dr.M, I want to play a new trick this year. I want to be a DJ and present dynamic music with colorful lights.
  • Page 90: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 90 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Knob 1× Colorful LED strip 1× micro USB Cable 3.Dream of Micko Can I play different music and make the LED band...
  • Page 91: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 91 / 115 The input value of Knob(P1) Sound The LED strip 0~128 Light up one LED 128~256 Light up two LEDs 256~384 Light up three LEDs 384~512 Light up four LEDs 512~640 Light up five LEDs...
  • Page 92 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 92 / 115 STEP3: Programming 1. Take programming “0<knob P1<128” as an example, set the range of Knob P1 through the “and” function in the “Operators” module, then put the set range into the condition of “if...then…else”...
  • Page 93 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 93 / 115 Figure 4.2.5 Run the Program...
  • Page 94: Invention Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 94 / 115 3. To convenient operation, we can make a little bit improvement, such as add a handle to the knob, or mark the range of each sound. Figure 4.2.7 Improvement 1 Figure 4.2.8 Improvement 5.Invention of Micko...
  • Page 95: Project 3: Automatic Door

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 95 / 115 Project 3: Automatic Door 1.Story of Micko and Dr.M Dr.M, please help me. Yesterday a friend of mine visited me and knocked the door. But that time I was listening music in the room and did not hear the knock.
  • Page 96: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 96 / 115 2.Dr.M's Pocket 2× micro: bit 2× micro: bit Expansion Board 1× LED Module 1× Push Button 2× micro USB Cable 1× Motion Sensor 3.Dream of Micko want know there anybody knock the doorbell...
  • Page 97 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 97 / 115 Dr.M, why should we use 2 boards now? Well, we need to use these two boards to imitate remote doorbell. We will put one of them into outside, which is equals to doorbell. This is the server.
  • Page 98: Dr.m's Blackboard

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 98 / 115 4.Dr.M's Blackboard STEP1: Hardware connection of micro: bit transmitter. Figure 4.3.1 Transmitter End Hardware connection of micro: bit receiver Figure 4.3.2 Receiver End STEP2: Get to know about wireless transmission module Dr.M, How could we send the signal if...
  • Page 99 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 99 / 115 The common wireless transmission module Signal Setting: Transmitting wireless signal: Receiving wireless signal: Notice : the receiver end needs to recognize the received signals so as to execute the related actions. The transmitter can send out both figures and letters.
  • Page 100 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 100 / 115 2. Programming according to the flow chart. Figure 4.3.4 Transmitter Programs STEP4: Program the receiver 1. Draw the flow chart, design the receiver programs. Figure 4.3.5 Receiver Flow Chart Little friend, here we also need to...
  • Page 101 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 101 / 115 2. Programming according to the flow chart. Figure 4.3.6 Receiver Program Sweetie, please do not forget “0”,”1”,”2” when reading the signal(please remember the string we read should go with “”). Result 1.
  • Page 102: Invention Of Micko

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 102 / 115 Display pattern 2 LED on Figure 4.3.8 Result 2 5.Invention of Micko Sweetie, please do not forget “0”,”1”,”2” when reading the signal(please remember the string we read should go with “”)
  • Page 103: Project4: The Bomb Escape

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 103 / 115 Project4: The Bomb Escape 1.Story of Micko and Dr.M Dr.M, my best friends will visit me. I want to play games with them. Good idea. Which games would you prefer? Some interesting games.
  • Page 104: Dr.m's Pocket

    Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 104 / 115 2.Dr.M's Pocket 1× micro: bit 1× micro: bit Expansion Board 1× Colorful LED Strip 1× micro USB Cable 3.Dream of Micko When we start play the game Bomb, the LEDs also enter the countdown mode at the time.
  • Page 105 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 105 / 115 4.Dr.M's Blackboard STEP1: Connect the colorful LED strip to pin P0 of the expansion board. Figure 4.4.1 Connection Diagram STEP2: Action Recognition 1. Learn the related commands Firstly, we need the micro: bit board to generate and display a direction...
  • Page 106 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 106 / 115 Dr.M, how to create a direction in arbitrary? Here we need to use the module random. Dr.M, how could we combine the module random with directions? Such a good question! Here we need to learn something new, that is the module “Create a...
  • Page 107 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 107 / 115 Get the current gesture: Use the “current gesture” function under “micro: bit” module to sense which direction the micro: bit board tilts. 2. Programming 1) Create a variable “target direction” to represent the arrow’s direction on micro: bit LED panel, set the variable value to “pick random 0 to 3”...
  • Page 108 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 108 / 115 Make a variable “operation direction” to represent the current direction the board tilts, and use it with “current gesture” to make the four “operation direction” correspond to the four numbers. Figure 4.4.5 Get the current gesture Here we need to use a “if…then…else”.
  • Page 109 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 109 / 115 STEP3: LED Strip Countdown 1. Draw a program flow chart The LEDs on the LED strip will go off one by one as the time goes by. The faster you react; the more LEDs keep on at last.
  • Page 110 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 110 / 115 3) The whole programs of the last two parts: Whole programs of the last two parts Figure 4.4.11 Dr.M, 10 seconds is a little too long. We want to speed it up!
  • Page 111 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 111 / 115 Here is the flow chart: Figure 4.4.12 Flow chart of score system 2. Programming 1) Create variables “points” and “score”, set them to 0. Combine them with “if…then…else” function to meet the requirements of the flow chart.
  • Page 112 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 112 / 115 2) The final program is shown as below: Function defines Action recognition LED strip countdown Score system...
  • Page 113 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 113 / 115 5.Invention of Micko Dr.M, the game Bomb is so interesting! We all have fun! Little friend, if you want to upgrade this game, you can create a mark in the end of the game. Come to explore this...
  • Page 114 DFRobot Community: www.dfrobot.com In this community, you can find many makers like you. Wish DFRobot community can record your growth. Wow! So wonderful! Dr.M, see you in the DFRobot community, wishing I could find more friends in the community.
  • Page 115 Welcome to the DFRobot blog: https://www.dfrobot.com/blog-tag-microbit.html 115 / 115...

Table of Contents