This file contains 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
// read the analog value from A/D convertor and store it | |
ch1 = analogRead(chan1); //ecg | |
ch2 = analogRead(chan2); //oximeter | |
ch3 = analogRead(chan3); //gsr | |
ch4 = analogRead(chan4); //co2 | |
ch5 = analogRead(chan5); //respitory rate | |
ch6 = 0; //temperature [digital] | |
// send the value over the port | |
packet [3] = cnt; | |
packet [5] = ch1; |
This file contains 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
class PID(object) : | |
def __init__(self, temp_probe, target) : | |
self.temp_probe = temp_probe | |
self.samples = [] | |
self.target = target | |
GPIO.setup(CHILLPIN, GPIO.OUT) | |
self.pid_ts = None | |
self.events = [] | |
GPIO.output(CHILLPIN, False) |
This file contains 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
pi@raspberrypi ~/timetemp $ sudo python setup.py install | |
running install | |
running build | |
running build_py | |
creating build | |
creating build/lib.linux-armv6l-2.7 | |
copying i2c7segment.py -> build/lib.linux-armv6l-2.7 | |
running install_lib | |
copying build/lib.linux-armv6l-2.7/i2c7segment.py -> /usr/local/lib/python2.7/dist-packages | |
byte-compiling /usr/local/lib/python2.7/dist-packages/i2c7segment.py to i2c7segment.pyc |
This file contains 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
pf.docfilter.010.source_code.name | |
pf.docfilter.010.source_code.desc | |
new config option | |
# PFPROJ-1148 - Categorize documents in Code Exchange [afustini] | |
pf.docfilter.010.code_exchange.name=Source Code | |
pf.docfilter.010.code_exchange.desc=Code Exchange<br/>Code Snippets | |
PFPROJ-1152 | |
"Source code" Site-wide category for Code Exchange & Gist macro |
This file contains 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 | |
from Adafruit_CharLCD import Adafruit_CharLCD | |
from twitter import * | |
from time import sleep | |
import textwrap | |
import re | |
twitter_search = Twitter(domain="search.twitter.com") | |
x = twitter_search.search(q="#openhardware") |
This file contains 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
class HashTagDisplay(): | |
def __init__(self, cols=16, rows=2, delay=3, debug=False): | |
# number of columns on the character LCD (min: 16, max: 20) | |
self.cols = cols | |
# number of rows on the character LCD (min: 1, max: 4) | |
self.rows = rows | |
# duration in seconds to allow human to read LCD lines | |
self.delay = delay | |
# print messages to shell for debugging | |
self.debug = debug |
This file contains 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
def search(self, hashtag): | |
""" search for tweets with specified hashtag """ | |
twitter_search = Twitter(domain="search.twitter.com") | |
return twitter_search.search(q=hashtag) | |
def display(self, results): | |
""" Display each tweet in the twitter search results """ | |
for tweet in results.get('results'): | |
msg = "@" + tweet.get('from_user') + ": " + tweet.get('text') | |
if self.debug == True: |
This file contains 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
hashTagDisplay = HashTagDisplay(cols=16, rows=2, delay=2, debug=True) | |
# repeat twitter search and display forever | |
while True: | |
results = hashTagDisplay.search(hashtag) | |
hashTagDisplay.display(results) |
This file contains 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
# /etc/modules: kernel modules to load at boot time. | |
# | |
# This file contains the names of kernel modules that should be loaded | |
# at boot time, one per line. Lines beginning with "#" are ignored. | |
# Parameters can be specified after the module name. | |
snd-bcm2835 | |
i2c-bcm2708 | |
/////////////////////////////////////////////////////////////////////// | |
root@raspberrypi:~# echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_deviceroot@raspberrypi:~# |
This file contains 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
afustini@lappy486:~/Downloads/autoadvent$ ./autoadvent.py "Dec 12 2012" | |
2012-12-12 | |
2012 | |
2012-12-12 >= 2012-12-02 | |
2012-12-12 >= 2012-12-09 | |
candles: 2 | |
17 | |
18 | |
afustini@lappy486:~/Downloads/autoadvent$ ./autoadvent.py "Dec 03 2012" | |
2012-12-03 |