Bit BBC SBC
Overview
Bit BBC SBC
Overview
Bit BBC SBC is an accessible, versatile, and feature-rich microcontroller that provides an ideal platform for learning, experimentation, and innovation. Its compact size, ease of use, and extensive feature set make it an excellent choice for a wide range of applications, from education to IoT development.
Micro:Bit BBC SBC Documentation
Overview
The Micro:Bit BBC SBC (Single-Board Computer) is a compact, low-power microcontroller designed for educational and IoT applications. It features a 32-bit ARM Cortex-M0 processor, 16 KB of RAM, and 256 KB of flash memory. The board includes a range of sensors, I/O interfaces, and a wireless communication module, making it an ideal platform for exploring IoT and robotics projects.
Hardware Features
32-bit ARM Cortex-M0 processor
16 KB of RAM and 256 KB of flash memory
MicroUSB connector for programming and power
25-pin edge connector for I/O expansion
5x5 LED matrix display
Accelerometer and magnetometer sensors
Bluetooth Low Energy (BLE) module
2x button inputs
1x reset button
Power management system
Code Examples
### Example 1: Blinking LEDs using MicroPython
This example demonstrates how to use the Micro:Bit BBC SBC to blink the onboard 5x5 LED matrix display using MicroPython.
```python
import microbit
while True:
microbit.display.show(microbit.Image.HEART)
microbit.sleep(500)
microbit.display.clear()
microbit.sleep(500)
```
In this example, we import the `microbit` module and use a infinite loop to toggle the display between the heart symbol and a blank display, creating a blinking effect.
### Example 2: Accelerometer Data Logging using C++ (mbed)
This example demonstrates how to use the Micro:Bit BBC SBC to read accelerometer data and log it to the console using C++ (mbed).
```cpp
#include <MicroBit.h>
MicroBit uBit;
void setup() {
uBit.init();
Serial.begin(115200);
}
void loop() {
int x, y, z;
uBit.accel.getAcceleration(&x, &y, &z);
Serial.printf("Accelerometer: x=%d, y=%d, z=%d
", x, y, z);
wait(0.1);
}
```
In this example, we include the `MicroBit.h` header file and initialize the Micro:Bit board. We then use the `getAcceleration()` function to read the accelerometer data and log it to the console using `Serial.printf()`.
### Example 3: Wireless Communication using BLE (JavaScript)
This example demonstrates how to use the Micro:Bit BBC SBC to establish a wireless connection with a BLE-enabled device and send a string message using JavaScript.
```javascript
const microbit = require('microbit');
microbit.init();
const ble = microbit.ble;
ble.on('connected', () => {
console.log('Connected to BLE device!');
ble.sendString('Hello from Micro:Bit!');
});
ble.advertise();
```
In this example, we require the `microbit` module and initialize the board. We then create a BLE instance and set up an event listener for when a connection is established. When connected, we send a string message using `ble.sendString()`. Finally, we start advertising the BLE service using `ble.advertise()`.