QUESTION: Number of Digital pins

Issue #106 resolved
Turgut Guneysu created an issue

Hi John,

micro:bit docs state:

MicroBlocks blocks “analog” reports 6, and “digital” reports 29.

Is the digital count correct ?

Comments (2)

  1. John Maloney repo owner

    Some of those pins are internal pins and the pin numbers comes from the Arduino framework for the micro:bit. Here’s the comment from the code:

    // See variant.cpp in variants/BBCMicrobit folder for a detailed pin map.
    // Pins 0-20 are for micro:bit pads and edge connector
    //  (but pin numbers 17-18 correspond to 3.3 volt pads, not actual I/O pins)
    // Pins 21-22: RX, TX (for USB Serial?)
    // Pins 23-28: COL4, COL5, COL6, ROW1, ROW2, ROW3
    // Button A: pin 5
    // Button B: pin 11
    // Analog pins: The micro:bit does not have dedicated analog input pins;
    // the analog pins are aliases for digital pins 0-4 and 10.
    

    But I agree, it is confusing. The idea is to make the internal pins available for advanced users. For example, if you wanted to write your own low-level code to control the 5x5 display, you’d need to use the internal row and column pins, pins 23-28.

  2. Log in to comment