This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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(): |