boochow / micropython-raspberrypi

bare metal Raspberry Pi Zero / Zero W port of MicroPython
MIT License
215 stars 24 forks source link

module rpi added which provides capability of accessing memory map #3

Closed boochow closed 6 years ago

boochow commented 6 years ago

LED blink sample for Raspberry Pi Zero/Zero W

import rpi
# set gpio47 to output mode
rpi.mem32[int("0x20200010")] = 2**21
# set gpio47 to L (LED on)
rpi.mem32[int("0x2020002C")] = 2**15
# set gpio47 to H (LED off)
rpi.mem32[int("0x20200020")] = 2**15