Skip to content

Instantly share code, notes, and snippets.

@Resseguie
Resseguie / gist:ad155ba7a7c24bd1c719
Created June 10, 2014 03:09
b5 and c6 sound the same
var five = require("../lib/johnny-five.js"),
board = new five.Board();
board.on("ready", function() {
// Creates a piezo object and defines the pin to be used for the signal
var piezo = new five.Piezo(3);
// Injects the piezo into the repl
board.repl.inject({
piezo: piezo
@Resseguie
Resseguie / piezo-scale.js
Created June 10, 2014 03:12
Simple scale based on J5 piezo API
var five = require("../lib/johnny-five.js"),
board = new five.Board();
board.on("ready", function() {
// Creates a piezo object and defines the pin to be used for the signal
var piezo = new five.Piezo(process.argv[2] || 3);
// Injects the piezo into the repl
board.repl.inject({
piezo: piezo
@Resseguie
Resseguie / spark-temp.js
Last active August 29, 2015 14:02
Voodoospark #23 code
var cylon = require('cylon');
cylon.robot({
connection: {
name: 'voodoospark',
adaptor: 'voodoospark',
accessToken: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID,
module: 'spark'
},
@Resseguie
Resseguie / sparkio-temp.js
Last active August 29, 2015 14:02
voodoospark #23 using spark-io
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 / joyToWorld.js
Created July 21, 2014 03:13
Joy to the World using J5 piezo. Crashes at "come" ( ["C4", 1] ) because it's missing a comma
var five = require('johnny-five');
five.Board().on('ready', function () {
var piezo = new five.Piezo();
var joyToWorld = {
song: [
["C5", 1],
["B4", 3/4],
["A4", 1/4],
@Resseguie
Resseguie / gist:b8297d36dd41b320f29f
Last active August 29, 2015 14:06
Spark RGB LED
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 / gist:e9418f05d6db50f1c774
Created September 14, 2014 03:24
Spark-IO RGB LED with timeout
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 September 15, 2014 02:20
Led.RGB.on doesn't save color state
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:e308663338f38ed7770c
Created September 15, 2014 03:41
RGB LED on then color
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 / say-all-voices.js
Created October 21, 2014 01:52
Iterates over all say.js voices
#!/usr/bin/env node
'use strict'
var say = require('say'),
toSay = process.argv[2] || "Hello World",
voices = [
"Agnes",
"Kathy",
"Princess",