The micro:bit is a small, programmable computer developed by the BBC and manufactured by micro:bit. It is designed to make learning coding and electronics accessible and engaging, especially for students and hobbyists. The micro:bit features a 5x5 LED matrix, two programmable buttons, an accelerometer, a magnetometer, and Bluetooth connectivity. It also includes GPIO pins for connecting external components, making it a versatile tool for a wide range of projects.
The micro:bit is packed with features that make it a powerful yet beginner-friendly device. Below are its key technical details:
The micro:bit has a 25-pin edge connector, with specific pins designated for power, GPIO, and communication. Below is a summary of the pin configuration:
Pin Number | Name | Description |
---|---|---|
1 | 3V | 3V power output for external components. |
2 | GND | Ground connection. |
3 | P0 | General-purpose I/O pin (can also be used as an analog input). |
4 | P1 | General-purpose I/O pin (can also be used as an analog input). |
5 | P2 | General-purpose I/O pin (can also be used as an analog input). |
6 | P3 (SDA) | I2C data line (shared with GPIO). |
7 | P4 (SCL) | I2C clock line (shared with GPIO). |
8 | P5 | Button A input (can also be used as GPIO). |
9 | P6 | General-purpose I/O pin. |
10 | P7 | General-purpose I/O pin. |
11 | P8 | General-purpose I/O pin. |
12 | P9 | General-purpose I/O pin. |
13 | P10 | General-purpose I/O pin (can also be used as an analog input). |
14 | P11 | Button B input (can also be used as GPIO). |
15 | P12 | General-purpose I/O pin. |
16 | P13 | SPI clock (SCK) or GPIO. |
17 | P14 | SPI MISO or GPIO. |
18 | P15 | SPI MOSI or GPIO. |
19 | P16 | General-purpose I/O pin. |
20 | P19 | I2C data line (alternative pin). |
21 | P20 | I2C clock line (alternative pin). |
The micro:bit is easy to use and program, making it ideal for beginners and advanced users alike. Below are the steps to get started and some best practices for using the micro:bit.
.hex
file..hex
file onto the micro:bit, which appears as a USB drive.The micro:bit can communicate with an Arduino UNO via I2C. Below is an example of how to send data from the micro:bit to the Arduino UNO:
// micro:bit acts as an I2C slave device
let counter = 0
basic.forever(function () {
pins.i2cWriteNumber(0x08, counter, NumberFormat.UInt8BE)
counter += 1
basic.pause(1000) // Send data every second
})
#include <Wire.h>
void setup() {
Wire.begin(0x08); // Join I2C bus with address 0x08
Serial.begin(9600); // Start serial communication for debugging
}
void loop() {
Wire.requestFrom(0x08, 1); // Request 1 byte from micro:bit
if (Wire.available()) {
int data = Wire.read(); // Read the received byte
Serial.println(data); // Print the data to the Serial Monitor
}
delay(1000); // Wait for 1 second before the next request
}
.hex
file was successfully copied to the micro:bit.By following this documentation, you can unlock the full potential of the micro:bit for your projects!