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 <SoftPWM.h> | |
#include <Thread.h> | |
/* DEFINES -------------------------------------------------------------------*/ | |
#define LED_COUNT 8 | |
#define MAX_BRIGHTNESS 75 // 100 to 255 | |
#define FADEUP_TIME_MS 50 | |
#define FADEDN_TIME_MS 2900 | |
#define MAXDELAY_MS 300 |
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
#require "FactoryTools.device.nut:1.0.0" | |
#require "TMP1x2.class.nut:1.0.3" | |
#require "WS2812.class.nut:2.0.1" | |
#require "LIS3DH.class.nut:1.0.2" | |
// Copyright (c) 2015 Electric Imp | |
// This file is licensed under the MIT License | |
// http://opensource.org/licenses/MIT | |
const SSID = "SSID"; |
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
// IR Tail Factory BlinkUp Fixture sample firmware | |
const SSID = "SSID"; | |
const PASSWORD = "PASSWORD"; | |
const BLINKUP_TIME = 5; // seconds; duration of blinkup | |
function log(msg) { | |
if (server.isconnected()) { | |
server.log(msg); |
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
// Load in the Electric Imp Factory Tools library | |
#require "FactoryTools.device.nut:1.0.0" | |
// CONSTS AND GLOBALS --------------------------------------------------------- | |
// Replace the following two strings with your factory network’s credentials | |
const SSID = "YOUR_FACTORY_SSID"; | |
const PASSWORD = "YOUR_FACTORY_WIFI_PASSWORD"; | |
const BLINKUP_INTERVAL_SECONDS = 10; |
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
// Copyright (c) 2015 Electric Imp | |
// This file is licensed under the MIT License | |
// http://opensource.org/licenses/MIT | |
// Factory Tools Library simplifies detecting Fixture or DUT | |
#require "FactoryTools.device.nut:1.0.0" | |
// CFAx33KL Library abstracts the LCD/Keypad used on the Factory BlinkUp Box | |
#require "CFAx33KL.class.nut:1.0.1" | |
// CONSTS AND GLOBALS --------------------------------------------------------- |
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
// AGENT CODE | |
#require "twitter.class.nut:1.1.0" | |
const KEY = "YOUR KEY"; | |
const API_SECRET = "YOUR API SECRET"; | |
const TOKEN = "YOUR TOKEN"; | |
const TOKEN_SECRET = "YOUR TOKEN SECRET"; | |
twitter <- Twitter(KEY, API_SECRET, TOKEN, TOKEN_SECRET); |
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
// AGENT CODE | |
#require "rocky.class.nut:1.2.2" | |
// instantiate the Rocky framework for our API | |
app <- Rocky(); | |
// say hello if someone requests our Agent URL | |
app.get("/", function(context) { | |
context.send("Try adding a color (red, green, blue) to the path!"); |
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
// MX25L3206E SPI Flash | |
class spiFlash { | |
// 16 blocks of 64k each = 1mb | |
static FAT_SIZE = 65536; // 1 block reserved for FAT | |
static TOTAL_MEMORY = 1048576; // 1 Megabytes | |
static LOAD_BUFFER_SIZE = 8192; // 8kb | |
// spi interface | |
spi = null; | |
cs_l = null; |
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
http.onrequest(function(req, resp) { | |
local state = 0; | |
if ("state" in req.query) { | |
state = req.query.state.tointeger(); | |
} | |
if (req.path == "/green") { | |
device.send("green", state); | |
} else if (req.path == "/red") { | |
device.send("red", state); |
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
device.on("data", function(data) { | |
server.log(http.jsonencode(data)); | |
}); |
NewerOlder