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
/** | |
* App Endpoint API Access Example | |
* | |
* Author: SmartThings | |
*/ | |
preferences { | |
section("Allow Endpoint to Control These Things...") { | |
input "switches", "capability.switch", title: "Which Switches?", multiple: true | |
input "locks", "capability.lock", title: "Which Locks?", multiple: true |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
server.log("Device started, impee_id " + hardware.getimpeeid() + " and mac = " + imp.getmacaddress() ); | |
//------------------------------------------------------------------------------------------------------------------------------ | |
// Uart57 for TX/RX | |
SERIAL <- hardware.uart57; | |
// FIRMATA CONSTANTS | |
const PIN_MODE = 0xF4; | |
const REPORT_DIGITAL = 0xD0; | |
const REPORT_ANALOG = 0xC0; |
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
//Code snippet for integrating with the Ninjablocks cloud | |
//Requires signing up with the Ninjablocks cloud here: https://a.ninja.is/born | |
// | |
//Assumptions: | |
// - Uses the User Access Token method | |
// - Create a Block ID that is unique and alphanumeric | |
// - | |
// | |
// NINJABLOCKS API |
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
imp.configure("Roomba", [], []); | |
hardware.pin1.configure(DIGITAL_IN_WAKEUP); | |
hardware.pin2.configure(DIGITAL_OUT_OD_PULLUP); | |
impWakeupPin <- hardware.pin1; | |
roombaWakeupPin <- hardware.pin2; | |
roombaWakeupPin.write(1); | |
hardware.uart57.configure(115200, 8, PARITY_NONE, 1, NO_CTSRTS); | |
//Connection will be either 115200 or 57600 |
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
// Tutorial 3: T1 & T2 combined Electric imp April inputs & outputs from JQM web app | |
//Imp & Agent are written in squirrel-lang.org They should have a .NUT extension. | |
//but I've used .js so the editor will use colour highlighting. |
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
//Tutorial 1 Reading Electric imp April input from JQM web app | |
//Imp & Agent are written in squirrel-lang.org They should have a .NUT extension. | |
//but I've used .js so the editor will use colour highlighting. |
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
// Tutorial 2 setting Electric imp April outputs from JQM web app | |
//Imp & Agent are written in squirrel-lang.org They should have a .NUT extension. | |
//but I've used .js so the editor will use colour highlighting. |