Skip to content

Instantly share code, notes, and snippets.

David Resseguie Resseguie

Block or report user

Report or block Resseguie

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
@Resseguie
Resseguie / gist:8302903
Created Jan 7, 2014
Oversimplified method of sending ThingSpeak updates from Spark Core. (Not really recommended for real world use.) This connects and sends data successfully several times, but eventually something hangs and it stops updating.
View gist:8302903
// ThingSpeak Settings
char thingSpeakAddress[] = "api.thingspeak.com";
String writeAPIKey = "THINGSPEAK_WRITE_KEY";
const unsigned int updateThingSpeakInterval = 30000;
// Variable Setup
unsigned long lastConnectionTime = 0;
// Initialize TCP Client
TCPClient client;
@Resseguie
Resseguie / gist:8294929
Created Jan 7, 2014
Attempting to send analog data from Spark Core to Thingspeak. (Note: Something still not fully working. First post works, then it hangs.)
View gist:8294929
// ThingSpeak Settings
char thingSpeakAddress[] = "api.thingspeak.com";
String writeAPIKey = "THINGSPEAK_WRITE_API";
const unsigned int updateThingSpeakInterval = 30000;
unsigned long lastConnectionTime = 0;
bool lastConnected = false;
int failedCounter = 0;
TCPClient client;
View dynoRestartAll.js
#!/usr/bin/env node
var Heroku = require('heroku-client');
var heroku = new Heroku({ token: process.env.HEROKU_API_TOKEN });
console.log('Restarting Dyno');
heroku.apps(process.env.APP_NAME).dynos().restartAll(function(err, res) {
console.log('done', err, res);
});
View _PWM for Servos.md

Servo PWM vs "Normal" PWM

This started from a chat in the [https://gitter.im/rwaldron/johnny-five](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%.

View gist:4c4a554eae159a819875
var five = require("johnny-five"),
Spark = require("spark-io"),
board, sensor;
// Create Johnny-Five board connected via Spark
board = new five.Board({
io: new Spark({
token: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID
})
@Resseguie
Resseguie / say-all-voices.js
Created Oct 21, 2014
Iterates over all say.js voices
View say-all-voices.js
#!/usr/bin/env node
'use strict'
var say = require('say'),
toSay = process.argv[2] || "Hello World",
voices = [
"Agnes",
"Kathy",
"Princess",
View gist:e308663338f38ed7770c
var five = require("johnny-five"),
Spark = require("spark-io"),
board = new five.Board({
io: new Spark({
token: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID
})
});
// The board's pins will not be accessible until
@Resseguie
Resseguie / rgb-on.js
Created Sep 15, 2014
Led.RGB.on doesn't save color state
View rgb-on.js
var five = require("johnny-five");
new five.Board().on("ready", function() {
console.log("CONNECTED");
var led = new five.Led.RGB([3,5,6]);
led.on();
setTimeout(function() {
@Resseguie
Resseguie / gist:e9418f05d6db50f1c774
Created Sep 14, 2014
Spark-IO RGB LED with timeout
View gist:e9418f05d6db50f1c774
var five = require("johnny-five"),
Spark = require("spark-io"),
board = new five.Board({
io: new Spark({
token: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID
})
});
// The board's pins will not be accessible until
View gist:b8297d36dd41b320f29f
var five = require("johnny-five"),
Spark = require("spark-io"),
board = new five.Board({
io: new Spark({
token: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID
})
});
// The board's pins will not be accessible until
You can’t perform that action at this time.