pxt-calliope/docs/device/pins.md
Abhijith Chatra be7858cbed
Cherry picked fixes from v0 to v1 ()
* Fix example and do a few edits ()

* Small fixes to the Karel project text ()

* fix missing shadow type

* add calibration info ()

microbit-support:6348 User reported bug, but didn't realie micro:bit compass had to be calibrated on first run of the program.

* Cherry pick adding various cross-editor compat APIs ()

* fix nudge

* Fix a typo ("screent") in the documentation ()

* Fix a typo
"screent" -> "the LED screen"

* Update showArrow doc string for consistency with other methods

* Doc bugs found by xlators ()

* Update rotation.md ()

reflects actual behaviour of the board

* fixed layout corruption ()

* Updating the new bug filer with the right link

* Update challenges.md ()

For what I'm taught in school, 2 follows 1 😉😉.

* Update simulator.md ()

* Update plant watering.md ()

the connection to servo are male not female

* support for MIDI simulator in v0 ()

* Doc improvements ()

* update grammar in radio-dashboard sample code

* Chanllenge 2 follows 1

I open all challenges.md without "Challenge 2" and review the file
`grep -r "Challenge 2" -L | grep challenge | xargs -I@ code @`

Changes to be committed:
	modified:   docs/lessons/counter/challenges.md
	modified:   docs/lessons/game-counter/challenges.md
	modified:   docs/lessons/night-light/challenges.md
	modified:   docs/lessons/snowflake-fall/challenges.md

* Revert "support for MIDI simulator in v0 ()"

This reverts commit 30a9c411fb80762656e7a636feff8e77b7fd9e67.

* Revert "Cherry pick adding various cross-editor compat APIs ()"

This reverts commit 7308dbef23e9ee402bebb7e721d7014d8252c9e5.

* Fixed pin needed to replace button A ()

* Cherry pick part of the signature update in in2cWriteBuffer (): 7308dbe
2018-10-22 10:00:57 -07:00

5.0 KiB
Raw Blame History

micro:bit pins

The micro:bit pins

The micro:bit has 25 external connections on the edge connector of the board, which we refer to as pins. The edge connector is the grey area on the right side of the figure above.

There are five large pins, that are also connected to holes in the board labelled: 0, 1, 2, 3V, and GND. And along the same edge, there are 20 small pins that you can use when plugging the micro:bit into an edge connector.

Large pins

You can easily attach crocodile clips or 4mm banana plugs to the five large pins.

The first three, labelled 0, 1 and 2 are flexible and can be used for many different things - which means they are often called general purpose input and output (shortened to GPIO). These three pins also have the ability to read analogue voltages using something called an analogue-to-digital converter (ADC). They all have the same function:

  • 0: GPIO (general purpose digital input and output) with analogue to digital convertor (ADC).
  • 1: GPIO with ADC
  • 2: GPIO with ADC

The other two large pins (3V and GND) are very different!

~hint

Watch out! The pins labelled 3V and GND relate to the power supply of the board, and they should NEVER be connected together.

~

power input: If the micro:bit is powered by USB or a battery, then you can use the 3V pin as a power output to power peripherals with.

  • 3V: 3 volt power output or power input. (1) power output: If the micro:bit is powered by USB or a battery, then you can use the 3V pin as a power output to power peripherals with; (2) power input: If the micro:bit is not being powered by USB or battery, you can use the 3V pin as a power input to power the micro:bit
  • GND: attaches to ground in order to complete a circuit (required when using the 3V pin)

If you hold the GND pin with one hand, you can program the microbit to detect yourself touching the 0,1 or 2 pins with your other hand, giving you three more buttons to experiment with (you just used your body to complete an electrical circuit).

Small pins

There are 20 small pins numbered sequentially from 3-22 (these pins are not labeled on the micro:bit, however, they are labelled in the picture above).

Unlike the three large pins that are dedicated to being used for external connections, some of the small pins are shared with other components on the micro:bit board. For example, pin 3 is shared with some of the LEDs on the screen of the micro:bit, so if you are using the screen to scroll messages, you cant use this pin as well.

  • pin 3: GPIO shared with LED Col 1 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off.
  • pin 4: GPIO shared with LED Col 2 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off.
  • pin 5: GPIO shared with Button A. This lets you trigger or detect a button "A" click externally. This pin has a pull-up resistor, which means that by default it is at voltage of 3V. To replace button A on the micro:bit with an external button, connect one end of the external button to pin 5 and the other end to GND. When the button is pressed, the voltage on pin 5 is pulled down to 0, which generates a button click event.
  • pin 6: GPIO shared with LED Col 9 of the LED screen; can be used for digital I/O when the LED screen is turned off.
  • pin 7: GPIO shared with LED Col 8 of the LED screen; can be used for digital I/O when the LED screen is turned off.
  • pin 8: Dedicated GPIO, for sending and sensing digital signals.
  • pin 9: GPIO shared with LED Col 7 of the LED screen; can be used for digital I/O when the LED screen is turned off.
  • pin 10: GPIO shared with LED Col 3 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off.
  • pin 11: GPIO shared with Button B. This lets you trigger or detect a button “B” click externally.
  • pin 12: this GPIO pin has been reserved to provide support for accessibility.
  • pin 13: GPIO that is conventionally used for the serial clock (SCK) signal of the 3-wire Serial Peripheral Interface (SPI) bus.
  • pin 14: GPIO that is conventionally used for the Master In Slave Out (MISO) signal of the SPI bus.
  • pin 15: GPIO that is conventionally used for the Master Out Slave In (MOSI) signal of the SPI bus.
  • pin 16: Dedicated GPIO (conventionally also used for SPI Chip Select function).
  • pins 17 and 18: these pins are wired to the 3V supply, like the large 3V pad.
  • pins 19 and 20: implement the clock signal (SCL) and data line (SDA) of the I2C bus communication protocol. With I2C, several devices can be connected on the same bus and send/read messages to and from the CPU. Internally, the accelerometer and the compass are connected to i2c.
  • pins 21 and 22: these pins are wired to the GND pin and serve no other function

Connecting to the small pins

It is recommended that an edge connector be acquired to connect to the small pins. More information on compatible edge connectors will be available later.