This file contains hidden or 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
// Establish threshold trigger flags for all your sensors | |
sensorOneTriggerFlag <- false | |
sensorTwoTriggerFlag <- false | |
// Define the function that will be called when the device has connected | |
// to the server (or the connection attempt times out) | |
function connectResponseCallback(reason) | |
{ |
This file contains hidden or 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
function sendPrefs(value) | |
{ | |
// Clock has requested the current set-up data | |
device.send("clock.set.prefs", clockPrefs) | |
} | |
. . . | |
// Register device-sent request for settings |
This file contains hidden or 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
const FACTORY_IMP_MAC = "0c2a690130b5" | |
if (imp.getmacaddress() == FACTORY_IMP_MAC) | |
{ | |
// Factory firmware running on factory imp, | |
// so run BlinkUp code | |
} | |
else | |
{ | |
// Factory firmware runnong on target device. |
This file contains hidden or 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 | |
function requestHandler(request, response) | |
{ | |
try | |
{ | |
if ("setcolor" in request.query) | |
{ | |
device.send("setcolor", request.query.setcolor) | |
response.send(200, "Color Set") |
This file contains hidden or 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
class LCD | |
{ | |
// A Squirrel class to drive a 16 x 2 to 20 x 4 character LCD driven by a Hitachi HD44780 controller | |
// via an MCP23008 interface chip on an Adafruit I2C backpack [http://www.adafruit.com/product/292] | |
// Communicates with any imp I2C bus | |
// Written by Tony Smith (@smittytone) October 2014 | |
// Version 1.0 | |
This file contains hidden or 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
class SSD1306OLED | |
{ | |
// Squirrel Class for Solomon SSD1306 OLED controller chip | |
// [http://www.adafruit.com/datasheets/SSD1306.pdf] | |
// As used on the Adafruit SSD1306 I2C breakout board | |
// [http://www.adafruit.com/products/931] | |
// Bus: I2C | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0.2 |
This file contains hidden or 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
class MAX7219 | |
{ | |
// Squirrel class for 8x8 LED matrix displays driven by the MAX7219 controller | |
// For example: https://www.sparkfun.com/products/11861 | |
// Communicates with any imp GPIO (three pins) | |
// Written by Tony Smith (@smittytone) Jume 2014 | |
// Version 1.0 | |
MAX7219_REGISTER_BCD = 0x09 |
This file contains hidden or 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
class DS3234RTC | |
{ | |
// Squirrel class for the Dallas/Maxim DS3234 real time clock used on the | |
// SparkFun DeadOn breakout board https://www.sparkfun.com/products/10160 | |
// | |
// Bus: SPI | |
// | |
// Written by Tony Smith, September 2014 | |
// Version 1.0 | |
NewerOlder