Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Onion Omega2 - Hello World
#!/usr/bin/env python
import onionGpio
from time import sleep
led = onionGpio.OnionGpio(18)
button = onionGpio.OnionGpio(1)
led.setOutputDirection(0)
button.setInputDirection()
while True:
value = button.getValue().rstrip()
print value
if(value == "1"):
led.setValue(1)
else:
led.setValue(0)
sleep(.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment