Skip to content

Instantly share code, notes, and snippets.

@miri64
Created June 11, 2014 08:04
Show Gist options
  • Save miri64/cf748f9525d8a3cfa34e to your computer and use it in GitHub Desktop.
Save miri64/cf748f9525d8a3cfa34e to your computer and use it in GitHub Desktop.
RIOT micropython vision
import RIOT.thread as thread
import RIOT.msg as msg
import RIOT.drivers.periph.gpio as gpio
class ReceiveThread(thread.Thread):
def run():
while True:
m = msg.receive()
print "Received message: {:s}".format(m.content)
if str(m.content) == "On":
gpio.set(gpio.GPIO_0)
print("GPIO 0 was set")
else:
gpio.clear(gpio.GPIO_0)
print("GPIO 1 was set")
if __name__ == "__main__":
thread = ReceiveThread()
thread.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment