Skip to content

Instantly share code, notes, and snippets.

@chadcooper
Last active August 29, 2015 14:02
Show Gist options
  • Save chadcooper/c5d5283bd2304dc6d03e to your computer and use it in GitHub Desktop.
Save chadcooper/c5d5283bd2304dc6d03e to your computer and use it in GitHub Desktop.
Most of this comes straight from the tutorials at http://micropython.org/doc/tut-contents.
# On OSX
# Connect via USB, open up Terminal, launch interactive REPL to Micro Python
$ screen /dev/tty.usbmodem*
# You'll get a prompt
Micro Python v1.0.1 on 2014-05-12; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>>
# Play around with the LEDs
>>> myled = pyb.LED(1)
>>> myled.on()
>>> myled.off()
# Flash all the LEDs
>>> leds = [pyb.LED(i) for i in range(1,5)]
>>> leds
[<LED 1>, <LED 2>, <LED 3>, <LED 4>]
>>>
n = 0
while True:
n = (n + 1) % 4
leds[n].toggle()
pyb.delay(50)
# Do a CTRL-C to end the loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment