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 MQTT publishing DHT11 sensor on Arduino
Basic MQTT example
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
// Our first sensor, a cheap DHT11 temperature and humidty sensor
#include <DHT.h>
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);
jamesabruce / ESP_RELAY_MQTT.ino
Created Feb 12, 2016
Simple MQTT controlled relay running on NodeMCU dev board on pin d2/gpio4
#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";
View ambilight.ino
// Slightly modified Adalight protocol implementation that uses FastLED
// library ( for driving WS2811/WS2812 led stripe
// Was tested only with Prismatik software from Lightpack project
#include "FastLED.h"
#define NUM_LEDS 114 // Max LED count
#define LED_PIN 6 // arduino output pin
#define GROUND_PIN 10
#define BRIGHTNESS 255 // maximum brightness
jamesabruce / neomatrix_pixel_display.ino
Created Jan 22, 2015
Sample code for working with the giant LED screen described at, using Adafruit Neomatrix and GFX libraries
View neomatrix_pixel_display.ino
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#define XSIZE 15
#define YSIZE 14
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(XSIZE, YSIZE, PIN,
jamesabruce / Control Philips Hue from Arduino Ethernet Shield
Created Apr 5, 2015
Example of using an Arduino with Ethernet shield to control Philips Hue, with PIR motion sensor on i/o pin 2.
View Control Philips Hue from Arduino Ethernet Shield
Talking to Hue from an Arduino
By James Bruce (
Adapted from code by Gilson Oguime.
#include <SPI.h>
#include <Ethernet.h>
// Hue constants
jamesabruce / robot_with_ping.ino
Created Dec 19, 2015
Beginner Robot with Ping Sensor
View robot_with_ping.ino
#include <NewPing.h>
//Tell the Arduino where the sensor is hooked up
NewPing sonar(12, 13);
int enableA = 11;
int pinA1 = 6;
int pinA2 = 5;
int enableB = 10;
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: '',
clientId: 'MakeUseOf Wifi Light'
var client = mqtt.connect(options);
View Arduino Sunrise Alarm Clock and Night Light by James Bruce
* Sunrise Alarm Clock and Night Light by James Bruce
* Initial setup requires you to reset the Arduino sometime in the evening.
* Set the hoursUntilSunrise relative to this time.
* eg, if you reset at 10pm, and want the sunrise to start at 6:30am,
* the value should be 8.5 - this will then be automatically changed to minutes for internal clock to function
jamesabruce /
Created Jul 14, 2015
DIY Proximity Lock v.01
import bluetooth
import time
import RPi.GPIO as GPIO
RELAY = 23
You can’t perform that action at this time.