Skip to content

Instantly share code, notes, and snippets.

View pdp7's full-sized avatar
💭
Linux on RISC-V

Drew Fustini pdp7

💭
Linux on RISC-V
View GitHub Profile
// 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;
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)
@pdp7
pdp7 / timetemp_notes.txt
Created September 24, 2012 14:52
[timetemp] install notes
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
@pdp7
pdp7 / config.txt
Created September 25, 2012 20:30
arduino configuration for my project
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
@pdp7
pdp7 / tweet.py
Created November 18, 2012 10:00
Raspberry Pi Adafruit CharLCD tweet display
#!/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")
@pdp7
pdp7 / hashtagdisplay_init.py
Created December 7, 2012 21:23
HashTagDisplay constructor
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
@pdp7
pdp7 / hashtagdisplay_search_display.py
Created December 7, 2012 21:28
HashTagDisplay search() and dispay() methods
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:
@pdp7
pdp7 / hashtagdisplay_main.py
Created December 7, 2012 21:31
HashTagDisplay usage
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)
@pdp7
pdp7 / gist:4260230
Created December 11, 2012 16:52
adventpi notes
# /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:~#
@pdp7
pdp7 / gist:4270024
Created December 12, 2012 17:54
advent output
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