Skip to content

Instantly share code, notes, and snippets.

View jamesabruce's full-sized avatar

James Bruce jamesabruce

  • Cornwall, UK
View GitHub Profile
/*
RESTduino
A REST-style interface to the Arduino via the
Wiznet Ethernet shield.
Based on David A. Mellis's "Web Server" ethernet
shield example sketch.
Circuit:
/*
Qyuick and dirty IR signal over i2c rebroadcast for
Lighting Cloud Mood Lamp By James Bruce
View the full tutorial and build guide at http://www.makeuseof.com/
Used to get around the limitations of having two libraries that both require exact timings to work right!
*/
#include <Wire.h>
#include <IRremote.h>
{"text":"These posts are still doing well: <http://www.makeuseof.com/tag/control-philips-hue-lights-arduino-and-motion-sensor/> (1392) ... <http://www.makeuseof.com/tag/3-easy-ways-tablet-stand/> (1037) ... <http://www.makeuseof.com/tag/upgrade-ps4s-hard-drive/> (2966) ","unfurl_links": true}
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
Jamess-iMac:Applications jamie$ ls -R
GitHub.app Vagrantfile Windows 7 Applications.app
./.vagrant/machines:
default
./.vagrant/machines/default:
virtualbox
./.vagrant/machines/default/virtualbox:
@jamesabruce
jamesabruce / Romantic_accessory.js
Created February 11, 2016 15:56
An accessory for HAP-NodeJS that integrates with Sonos HTTP API server running on localhost
var Accessory = require('../').Accessory;
var Service = require('../').Service;
var Characteristic = require('../').Characteristic;
var uuid = require('../').uuid;
var request = require('request');
// here's a fake hardware device that we'll expose to HomeKit
var FAKELIGHT = {
powerOn: false,
brightness: 100, // percentage
@jamesabruce
jamesabruce / Bedroomplug_accessory.js
Created February 12, 2016 10:18
A simple HAP-NodeJS accessory for a DIY power socket device
var Accessory = require('../').Accessory;
var Service = require('../').Service;
var Characteristic = require('../').Characteristic;
var uuid = require('../').uuid;
var mqtt = require('mqtt');
var options = {
port: 1883,
host: '192.168.1.99',
clientId: 'Bedroom plug accessory'
};
@jamesabruce
jamesabruce / sonos.js
Created March 1, 2016 13:33
If-This-Then-Node plugin to send voice notifications to Sonos through Sonos-HTTP-API
var request = require('request');
module.exports = {
run: function (params, log, callback) {
request('http://localhost:5005/sayall/'+params.message+'/en-gb', function (error, response, body) {
console.log("Sent message \""+params.message+"\" to device "+params.device);
})
callback({
'success': true,
'output': 'all good!'
@jamesabruce
jamesabruce / flora-clutch.ino
Created March 10, 2016 10:02
Light-Up Clutch Demo of Element14 Flora Arduino Starter Kit
// things from the color sensor library
#include
#include "Adafruit_TCS34725.h"
/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
// including things from light sensor library
@jamesabruce
jamesabruce / 4wd-robot-test.ino
Created December 17, 2015 10:18
First program for 4WD Arduino Robot Kit
// Motor A pins (enableA = enable motor, pinA1 = forward, pinA2 = backward)
int enableA = 11;
int pinA1 = 6;
int pinA2 = 5;
//Motor B pins (enabledB = enable motor, pinB2 = forward, pinB2 = backward)
int enableB = 10;
int pinB1 = 4;
int pinB2 = 3;