Download presentation
Presentation is loading. Please wait.
1
micro:bit
3
Features The micro:bit board, an ARM-based development board
It is a very easy to use and includes a lot of peripherals No need for soldering or use of external hardware to get started with The processor is an nRF51 It has 16 KB of RAM and 256 KB of FLASH
4
Features The micro:bit has 19 GPIOs available as assignable. Up to 3 can be assigned as PWM pins and 6 as analog inputs. The ADC of the processor has a resolution of 10 bits The GPIOs also have support for I2C, SPI and Serial communication interfaces The board has a Freescale MKL26Z128VFM4 microcontroller, which is responsible for handling the USB connection between the micro:bit board and a computer, and also for the flashing of new code. The micro:bit board is detected as a USB disk when connected to our computer
5
Digital / Analog
6
Features The micro:bit board has several peripherals on board (I2C)
It has a Freescale MMA8653FC, a 3-axis accelerometer with a resolution of 10 bits. It also has an on board Freescale MAG3110 magnetometer, which allows to get magnetic field strength measurements (I2C) The nRF51 processor has an integrated temperature sensor with a resolution of, 0.25°C and an accuracy of +-4°C. The board has 2 two buttons for user input. There is an additional button that allows to reset the system. The micro:bit board also has a 5×5 LED matrix for display purposes The micro:bit board has a 2.4 GHz transceiver, which allows it to support Bluetooth low energy to establish communication with other devices Besides Bluetooth, the radio of the board also allows the use of the Nordic Gazell protocol, which is a proprietary protocol that allows communication between devices that support it. This protocol operates on the 2.4 GHz, like Bluetooth.
7
Programming environments
The micro:bit has many development environments available, some of them designed to make it easy for beginners to get started, as Microsoft’s MakeCode This editor offers the possibility of simulating the code execution very easily. A model of the micro:bit board is located at the left side of the code editing window and by the click of a button testing starts In terms of higher level languages, the micro:bit can be programmed in Java, Python or C
8
MakeCode https://www.dfrobot.com/product-1587.html
10
The micro:bit - a reactive system
There are different types of computing systems, to address different kinds of problems that arise in practice: transaction processing systems are used by banks to handle huge numbers of financial transactions by their customers; distributed systems make a set of networked computers appear as one big computer (like Google’s search engine); there are also parallel systems, such as graphic cards, which perform a huge number of primitive operations simultaneously, using a great number of small processing cores. The micro:bit is a reactive system – it reacts continuously to external events, such as a person pressing the A button of the micro:bit or shaking the device. The reaction to an event may be to perform a computation, update variables, and change the display. After the device reacts to an event, it is ready to react to the next one. If this sounds like a computer game, that’s because most computer games are reactive systems too!
11
The micro:bit - a reactive system
A responsive system is able to do several things at the same time. As the micro:bit only has one CPU it can only execute one program instruction at a time. The micro:bit can execute millions of instructions per second, so it is possible for the device to alternate among instruction sequences of different programs. Let’s think about three sequences of instructions: Sequence S1: contains the instructions (let’s say several hundred thousand or so) that scroll the number 42 across the LED screen. Sequence S2: contains a few instructions to check if button A is pressed. Sequence S3: contains a few instructions to increment a counter. The micro:bit interrupts the execution of sequence S1 periodically to execute the sequence S2, which will check if button A is pressed, which looks like:
12
The micro:bit - a reactive system
The result is that it takes sequence S1 a little longer to complete, due to the interruptions to execute sequence S2, but we are checking often enough to detect a press of button A . When S2 detects a press of button A, then the sequence S3 can be executed before S1 resumes:
13
Examples Go to https://makecode.microbit.org/projects/
Program examples Flashing Heart Name Tag Rock Paper Scissors Mood Radio Fireflies Go to Program Microbit Project 13:
14
Maqueen
15
Maqueen
16
Maqueen Supply Voltage: 3.5V-5V DC ( Three AAA batteries or 3.6V~3.7V lithium battery ) Infrared Grayscale Sensor(High-low level) x 2 Buzzer x 1 Infrared Receiver (NEC decoder) x 1 LED Lights (High-low level control) x 2 RGB Ambient Light (16 million colors) x 4 SR04, SR04P Ultrasonic Interface(5V) x 1 IIC Interface (3.3V) x 1
17
Maqueen Gravity Extension Interfaces (P1, P2) x 2
N20 All-metal Gear Motor x 2 Motor Reduction Ratio: 1:150 Maximum Rotate Speed: 133 rpm Motor Drive Mode: PWM motor drive Bracket and Protective Cover Extension M3 Screw Hole x 6 Programming Method: Makecode graphical programming, Mind graphical programming (based on Scratch 3.0) Dimension: 81mm x 85 mm x 44mm/3.19 x 3.35 x 1.73in Weight: 75.55g
18
Maqueen Go to E(ROB0148) Import the Makecode Graphical Library
19
Continuation Activities
Download the “Terminal” at Practice the “Serial” commands Use the online help or visit Practice the “Text” commands Use the online help or visit For the sensors “Temperature,” “Acceleration,” and “Compass,” write programs that send the read values to the computer. Try to make the sensor values change; consider using “pause.” For the Acceleration, what is the meaning of the negative values? For the Compass, is there any difference in the readings when the micro:bit is horizontal, compared to when it is vertical?
20
Continuation Activities
This program requires the text terminated with CR+LF. On terminal v1.93 you do this as indicated in the figures below. Check both boxes.
21
Continuation Activities
For the Maqueen Write a program that measure distance and send to the screen Study the object avoidance example Study the line-following example, write your own version.
22
Continuation Activities
This program reads the distance from the ultrasonic sensor and sends the value to the UART
23
Sending Text Over Bluetooth
24
Sending Text Over Bluetooth
This functions receives “text”, a text argument If the length of text exceeds the Bluetooth capacity, an “X” is shown, and the program gets locked Else “text” is sent over Bluetooth
25
Sending Text Over Bluetooth
This function rounds a number to two decimal places The result is stored in “roundResult” as text, there is not any function to round decimal paces in MakeCode.
26
Sending Text Over Bluetooth
This program calculates the square root of a sequence of numbers “on start” initializes Bluetooth and the first number to obtain the square root Show index is used to provide feedback to the user
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.