Skip to content

Instantly share code, notes, and snippets.

View bassdread's full-sized avatar

bassdread

  • UK
View GitHub Profile
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import platform
import requests
class Choir:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
self.version = platform.python_version_tuple()
@bassdread
bassdread / gist:8088217
Created December 22, 2013 20:46
arduino code
// color swirl! connect an RGB LED to the PWM pins as indicated
// in the #defines
// public domain, enjoy!
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
#define FADESPEED 5 // make this higher to slow down
@bassdread
bassdread / gist:8088230
Last active January 1, 2016 03:49
update blinkstick and led strip code, still rough round the edges.
from blinkstick import blinkstick
import requests
import serial
import webcolors
import time
import json
# url to fetch from
cheer_lights_url = "http://api.thingspeak.com/channels/1417/field/1/last.json"
serial_port = '/dev/tty.usbmodem1421'
@bassdread
bassdread / gist:8406514
Created January 13, 2014 19:34
Nunchuck powered robot base!
#include <Wire.h>
#include <string.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *motor3 = AFMS.getMotor(3);
Adafruit_DCMotor *motor4 = AFMS.getMotor(4);
@bassdread
bassdread / gist:8407496
Created January 13, 2014 20:29
Code for output json from Arduino. The code also listens on serial for commands to turn the pump on and off.
#include <DHT.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085.h>
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
int LDR_Pin = A0;
@bassdread
bassdread / Extract from Skynet to Plot.ly
Last active August 29, 2015 13:57
Extract from Skynet to Plot.ly
from pymongo import Connection
import time
from datetime import datetime
import plotly
conn = Connection('localhost', 27017)
db = conn.skynet
collection = db.events
# 24 hour time range
import platform
import requests
class SeedBox:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
self.version = platform.python_version_tuple()
// Author:Chris Hannam
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
import platform
import requests
class Weather:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
self.version = platform.python_version_tuple()