Getting started with the micro:bit AdapterUpdated 4 months ago
The input pins P0, P1, and P2 are used to transfer data from the littleBits circuit to the micro:bit itself. Normally in littleBits circuits you would attach input bits (pink bits) to those. The micro:bit adapter is also powered through one of these three pins. Input pins should be used with the analog read pin or digital read pin blocks located under Advanced > Pins. When using multiple inputs at the same time, make sure that all sensors are connected to a power source.
The output pins P13, P14, and P15 are used to transfer data from the micro:bit to the rest of the littleBits circuit. Normally in littleBits circuits you would attach output bits (green bits) to those. Output pins should be used with the analog write pin or digital write pin blocks located under Advanced > Pins.
ANALOG vs DIGITAL
You can think of the difference between digital and analog like the difference between a normal ON-OFF light switch and a light dimmer.
Digital signals are either ON (set to 1) or OFF (set to 0). The digital write pins and digital read pins only have two possible values. The digital write pin block will set the output of the pin to either 0 or 1. When reading with a digital read pin block, the value returned will be either 0 or 1.
Analog signals can have a range of values. LittleBits sensors return values from 0 to 99 that scales linearly. For instance, if the proximity sensor detects an object at half of its maximum sensing distance, it will return the value 50.
The analog write pin block will set the output of the pin to any value between 0 and 1023.
When reading with an analog read pin block, the value returned will range from 0 to 1023.
In order to use the littleBits analog scale with the micro:bit scale, you will need to convert the values from one range scale to the other. The easiest way to convert is to divide the analog value by 10 to get an approximate range closer to the littleBits range of 0 to 99.
A littleBits analog value of 40 or less will always correspond to a digital 0. An analog value of 60 or more will always correspond to a digital 1.
Although you can use all inputs and outputs with both analog and digital blocks, we recommend you use the bits with the blocks as described in the table below:
LED (any kind)
Wire to a sensor*
LED (any kind)
* See paragraph below
POWER AN INPUT
You can power an input of the micro:bit adapter from the output of the adapter. Connect a wire on one of the output pins, to a sensor, then to an input pin. Then, you need to use the digital write block, set to 1 on the output pin in your program, as seen below: