Accessing the row pins for LED display

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
kjw
Posts: 1
Joined: Wed Jun 17, 2020 11:34 am

Accessing the row pins for LED display

Post by kjw » Wed Jun 17, 2020 11:40 am

Is it possible to access the pins for the rows of the LED display to allow direct, low-level control of the LED screen after a display_off(), of course? The columns appear to be available as microbit.pinX but I've not worked out how to access the rows.

User avatar
jimmo
Posts: 1710
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Accessing the row pins for LED display

Post by jimmo » Mon Jun 29, 2020 7:10 am

kjw wrote:
Wed Jun 17, 2020 11:40 am
The columns appear to be available as microbit.pinX but I've not worked out how to access the rows.
My understanding is that the column pins are available because they are also shared with the edge connector.

If you want to access the row pins you can do so via machine.mem32 to read and write the pin registers directly... (not fun, but also once you've got it working it's very simple).

e.g. this does pin 13, but you can look up the nrf51822 reference manual for the other addresses and bits to set for the row pins (although you might also have to set the pin mode).

Code: Select all

    # pin13 = 1
    machine.mem8[0x5000050a] |= 0b10000000
    # pin13 = 0
    machine.mem8[0x5000050e] |= 0b10000000

Post Reply