Skip to content

Instantly share code, notes, and snippets.

@kareiva
Created March 25, 2017 21:49
Show Gist options
  • Save kareiva/bc076c1cf9ab7cb97519e9afd86d4bc7 to your computer and use it in GitHub Desktop.
Save kareiva/bc076c1cf9ab7cb97519e9afd86d4bc7 to your computer and use it in GitHub Desktop.
Example how to use wiringpi2 library for Odroid C1+
#!/usr/bin/python
# Example how to use relay board with Odroid C1+
#
# Installation instructions:
# https://github.com/hardkernel/WiringPi2-Python/
#
# Pinout:
# http://pi4j.com/images/odroid-xu4-shifter-shield-pinout-large.png
import wiringpi2 as wpi
import time
leds = [21, 22, 23, 24]
wpi.wiringPiSetup()
def l_on(led):
wpi.pinMode(led, 1)
print 'On: ' + str(x)
def l_off(led):
wpi.pinMode(led, 0)
wpi.digitalWrite(led, 0)
print 'Off: ' + str(x)
for x in leds:
l_on(x)
time.sleep(0.25)
for x in leds:
l_off(x)
time.sleep(0.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment