Skip to content

Instantly share code, notes, and snippets.

@fvdbosch
Created January 21, 2017 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fvdbosch/2454ba283781da7ef06307dcd951ac05 to your computer and use it in GitHub Desktop.
Save fvdbosch/2454ba283781da7ef06307dcd951ac05 to your computer and use it in GitHub Desktop.
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