Skip to content

Instantly share code, notes, and snippets.

/*
Requires:
- pi-gpio
- gpio-admin
This snippet is intended to be the hello world equivalent for working
with the raspberry pi gpio with node.js. This simply flashes an LED
connected to pin 7 based on the duration.
*/
#!/usr/bin/python
# time module is needed for sleep function:
import time
# Open up the pins and set mode in/out
# TODO: Error handling
setupPin = file("/sys/class/gpio/export", "w")
setupPin.write("%d" % (38))
setupPin.close()
#!/usr/bin/python
import smbus
import time
# Plot a graph of the z-axis acceleration using a Raspberry Pi connected
# to one of these: http://www.pololu.com/catalog/product/1250
# Datasheet: http://www.pololu.com/file/download/LSM303DLH.pdf?file_id=0J433
def main():