Skip to content

Instantly share code, notes, and snippets.

View sasimpson's full-sized avatar

Scott Simpson sasimpson

View GitHub Profile
@sasimpson
sasimpson / gist:1405374
Created November 29, 2011 16:15
python to send proper hex to arduino program
def color_bulb(s, bulb, i, rgb):
req = "2E %02X %s %02X %02X %02X" % (bulb, i, rgb[0], rgb[1], rgb[2])
print req
s.write(binascii.unhexlify(''.join(req.split())))
@sasimpson
sasimpson / gist:1334943
Created November 2, 2011 21:13
dallas temperature to rgb led on arduino
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 10
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
struct RGB {
byte red;
@sasimpson
sasimpson / gist:1112739
Created July 28, 2011 22:37
Ruby Net:HTTP chunked transfer
require 'uri'
require 'net/http'
class Chunked
def initialize(data, chunk_size)
@size = chunk_size
if data.respond_to? :read
@file = data
end
end