General purpose input/output pins
The micro:bit’s edge connector provides access to many of the processor’s GPIO pins, which you can use to connect external components. Some pins are shared with other micro:bit features, but they can be used for other purposes if certain software features are turned off.
Sample Code
Note: We can connect third-party components to the micro:bit to make our projects more interactive. In this example, we are using a servo motor to show how the micro:bit can control an external device. The connection setup is shown in the picture below.
Hardware Connection: First, take the red alligator clip and bite onto the "3V" hole on your micro:bit. Connect the other end to the red wire to give the motor its power. Next, take the black alligator clip and grab onto the "GND" hole. Connect the other end to the black wire, which helps safely complete the power circle. Finally, take the yellow alligator clip and clip it to the "0" hole. Connect the other end to the yellow wire. This is the special wire that sends messages to tell the motor exactly how to move.
Program Link: https://makecode.microbit.org/_PfV4utAaxKbk
Result: Connect a servo to pin P0, and it should continuously alternate between 90 degrees and 0 degrees, pausing for two seconds at each position.
Specifications
| Item | Details |
|---|---|
| Rings | 3 large IO rings and two large power rings, 4mm plug and crocodile clip compatible |
| GPIO features | 19 assignable GPIO pins |
| 2 are dedicated to the external I2C interface | |
| 6 are used for display or light sensing feature | |
| 2 are used for on-board button detection | |
| 1 is reserved for an accessibility interface | |
| 19 may be assigned as digital input or digital output | |
| 19 may be assigned for up to 3 simultaneous PWM channels | |
| 19 may be assigned for 1 serial transmit and 1 serial receive channel | |
| 6 may be assigned as analog input pins | |
| 3 may be assigned to an optional SPI communications interface | |
| 3 may be assigned for up to 3 simultaneous touch sensing inputs | |
| ADC resolution | 10 bit (0..1023) |
| Edge Connector | Edge connector |
| Pitch | 1.27mm, 80 way double sided. |
| Pads | 5 pads, with 4mm holes |