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 | |
| # read 16-bit EEPROMs over I2C. tested with 24FC512 and 24LC515 | |
| import sys | |
| import smbus | |
| bus = smbus.SMBus(1) # /dev/i2c-1 | |
| if len(sys.argv) < 3: | |
| sys.stderr.write("usage: %s device_address size > filename\n" % (sys.argv[0],)) | |
| raise SystemExit |
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 | |
| # write 16-bit EEPROMs over I2C | |
| import sys | |
| import smbus | |
| import time | |
| bus = smbus.SMBus(1) | |
| if len(sys.argv) < 2: | |
| sys.stderr.write("usage: %s device-address\n" % (sys.argv[0],)) |
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
| 00000000 ?? 88 56 82 8c 6f 58 50 80 50 82 22 5d a0 b0 c2 |..V..oXP.P."]...| | |
| 00000010 20 86 c0 9a 82 94 79 6a 50 80 70 71 36 54 a0 b0 | .....yjP.pq6T..| | |
| 00000020 c2 20 82 92 58 88 96 6f 00 a0 80 70 81 02 4b a0 |. ..X..o...p..K.| | |
| 00000030 b0 c5 20 60 89 cb 80 70 60 00 a0 80 80 82 03 03 |.. `...p`.......| | |
| 00000040 a0 a8 cd 2c 84 f6 0c 20 61 c8 0c 20 61 c8 08 20 |...,... a.. a.. | | |
| 00000050 60 08 40 f4 40 43 40 f4 40 43 40 f4 42 41 ff ff |`.@.@C@.@[email protected]..| | |
| 00000060 00 11 00 7b 7b 7b 00 ff ff ff ff 7b 7b 7b 7b 00 |...{{{.....{{{{.| | |
| 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 7b |...............{| | |
| 00000080 00 02 00 02 00 02 00 01 04 00 00 00 00 00 00 00 |................| | |
| 00000090 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 00 |................| |
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 RPi.GPIO as GPIO | |
| import time | |
| GPIO.setmode(GPIO.BOARD) | |
| # Data and address pins | |
| # MSB first |
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 | |
| # turn on yellow LED when CD/DVD tray fully open, blue LED when fully closed | |
| import RPi.GPIO as GPIO | |
| import time | |
| GPIO.setmode(GPIO.BOARD) | |
| OPSW = 22 # G25 |
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 | |
| # eject CD/DVD tray using GPIO to turn on motor until switch closes | |
| import RPi.GPIO as GPIO | |
| import signal | |
| import sys | |
| import time | |
| GPIO.setmode(GPIO.BOARD) |
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 RPi.GPIO as GPIO | |
| import sys | |
| GPIO.setmode(GPIO.BOARD) | |
| K1 = 38 # G20 | |
| K2 = 7 # G4 | |
| K3 = 36 # G16 |
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 RPi.GPIO as GPIO | |
| import sys | |
| GPIO.setmode(GPIO.BOARD) | |
| C = 38 # G20 | |
| D = 40 # G21 |
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 | |
| # open/close CD/DVD tray from Raspberry Pi GPIO via H-Bridge | |
| import RPi.GPIO as GPIO | |
| import time | |
| import sys | |
| import signal | |
| GPIO.setmode(GPIO.BOARD) |
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 | |
| # -*- coding: utf-8 -*- | |
| # SPI_MCP3304.py: read 8-channel ADC, based on http://www.havnemark.dk/?p=54 | |
| # mcp3008_lm35.py - read an LM35 on CH0 of an MCP3008 on a Raspberry Pi | |
| # mostly nicked from | |
| # http://jeremyblythe.blogspot.ca/2012/09/raspberry-pi-hardware- spi-analog-inp$ | |
| # Changed to work w. MCP3308 by Kim H. Rasmussen, June 2013 | |
| import spidev | |
| import time |