Skip to content

Instantly share code, notes, and snippets.

@ka010
Created June 23, 2010 14:00
Show Gist options
  • Save ka010/449955 to your computer and use it in GitHub Desktop.
Save ka010/449955 to your computer and use it in GitHub Desktop.
# basic example of how to use avrBridgePy.
# once you have a reference to the wrapped library,
# you can use the API defined in avrBridgeC.h
#
# this example blinks an led on portD - pin0
import time
import avrBridgePy as avrBridgePy
#get a wrapper instance
bridge = avrBridgePy.avrBridge()
#get a direct reference to libavrBridgeC
mega = bridge.mega
#configure pinD0 as output
mega.setPortPinDir(bridge.PORTD, 0, bridge.OUT)
#loop
while True:
print "ON"
mega.setPortPin(bridge.PORTD, 0, bridge.ON)
time.sleep(1)
print "OFF"
mega.setPortPin(bridge.PORTD, 0, bridge.OFF)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment