Skip to content

Instantly share code, notes, and snippets.

James Bruce jamesabruce

Block or report user

Report or block jamesabruce

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View POVwriter.ino
// how long each led stays on for
int delayTime = 1;
//how long between each
int charBreak = 3;
//how long to wait after the message is finished before it repeats
int resetTime = 20;
int LED1 = 2;
int LED2 = 3;
int LED3 = 4;
View Newsletter Subscription sample form
<form data-fv-framework="bootstrap" novalidate="novalidate" class="fv-form fv-form-bootstrap"><button type="submit" class="fv-hidden-submit" style="display: none; width: 0px; height: 0px;"></button>
<div class="items">
<div class="item">
<input type="hidden" name="topics[0][type]" value="category">
<input type="hidden" name="topics[0][id]" value="4893">
<input type="hidden" name="topics[0][checked]" value="0">
<label><div class="checker"><span><input name="topics[0][checked]" value="1" type="checkbox"></span></div><span>Smart Home</span></label>
</div>
<div class="item">
<input type="hidden" name="topics[1][type]" value="post_tag">
@jamesabruce
jamesabruce / flora-clutch.ino
Created Mar 10, 2016
Light-Up Clutch Demo of Element14 Flora Arduino Starter Kit
View flora-clutch.ino
// 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 / sonos.js
Created Mar 1, 2016
If-This-Then-Node plugin to send voice notifications to Sonos through Sonos-HTTP-API
View sonos.js
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 / ESP_RELAY_MQTT.ino
Created Feb 12, 2016
Simple MQTT controlled relay running on NodeMCU dev board on pin d2/gpio4
View ESP_RELAY_MQTT.ino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <PubSubClient.h>
#define RELAY 4 // pin labelled d2
// Update these with values suitable for your network.
const char* ssid = "YOURWIFI";
@jamesabruce
jamesabruce / Bedroomplug_accessory.js
Created Feb 12, 2016
A simple HAP-NodeJS accessory for a DIY power socket device
View Bedroomplug_accessory.js
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 / Romantic_accessory.js
Created Feb 11, 2016
An accessory for HAP-NodeJS that integrates with Sonos HTTP API server running on localhost
View Romantic_accessory.js
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 / Officelight_accessory.js
Last active Sep 5, 2018
HAB-NodeJS accessory for MakeUseOf Wi-Fi light tutorial
View Officelight_accessory.js
// MQTT Setup
var mqtt = require('mqtt');
console.log("Connecting to MQTT broker...");
var mqtt = require('mqtt');
var options = {
port: 1883,
host: '192.168.1.99',
clientId: 'MakeUseOf Wifi Light'
};
var client = mqtt.connect(options);
@jamesabruce
jamesabruce / NodeMCU-MQTT-Siri-Wifi-Light.ino
Created Jan 29, 2016
Wi-Fi Neopixel light controlled over MQTT, to be connected through HAP-NodeJS to Siri
View NodeMCU-MQTT-Siri-Wifi-Light.ino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <PubSubClient.h>
#include <Adafruit_NeoPixel.h>
#define PIN 4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, PIN, NEO_GRB + NEO_KHZ800);
View newping_demo.ino
#include <NewPing.h>
//Tell the Arduino where the sensor is hooked up
NewPing sonar(12, 13);
long inches;
void setup() {
//Activate the serial monitor so you can see the output of the sensor
Serial.begin(9600);
You can’t perform that action at this time.