This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
NewerOlder