Instantly share code, notes, and snippets.

View esp8266_mqtt.ino
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two seconds
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
View package.json
"name": "lasertest",
"version": "1.0.0",
"description": "Used to pan tilt and fire a laser",
"main": "led.js",
"dependencies": {
"johnny-five": "^0.9.53"
"devDependencies": {},
"scripts": {
View matrix.js
var five = require("johnny-five");
var board = five.Board();
//Define Data Command Parameters
var Mode_Address_Auto_Add_1 = 0x40 //0100 0000 B
var Mode_Permanent_Address = 0x44 //0100 0100 B
board.on("ready", function() {

To try it out make sure you use the latest backpack from ajfisher/nodebots-hcsr04 using i2c_multiping branch


This is a little slack bot I made which is used to get results for the EU Referendum in the UK

Set up

npm install cheerio botkit request

Log into slack, create a new bot and then get the token for it.

Drop the token into the brexitbot.js file where it says "PUT YOUR TOKEN HERE"


Get bin file from this gist.

Copy bin file into a location on the edison side. I'll call this /tmp/firmware

ssh onto edison then cd into /tmp/firmware

from there:

npm install avrgirl-arduino
The MIT License (MIT)
Copyright (c) 2015 ajfisher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View app.js
var five = require("johnny-five");
var colour_sensor = require("./coloursensor.js")
var board = five.Board();
var led;
board.on('ready', function() {
var cs = new colour_sensor({
address: 0x29,
View _PWM for

Servo PWM vs "Normal" PWM

This started from a chat in the [](Johnny Five Gitter) and I thought I'd put some notes together because this comes up relatively often as people run into the terminology confusion that is caused by the Servo Manufacturers adopting the term PWM and it's usage amongst the Arduino community in relation to analogWrite().

This is my attempt at an explanation so if I've made any mistakes then please PR and we can make this better for everyone.

Servo is generally served by PWM support, right?

Sort of - PWM is typically a reference to an on/off duty cycle time - if I set my duty cycle to 50% then my pulses are on for 50% of the time and off for 50% of the time. If it's 10% then it's on 10% of the time, off 90%.