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
// round-trip-latency-xively | |
// measures round-trip latency by sending inverted input back to output, log to xively.com | |
// [agent code] | |
// Xively account credentials | |
const MyApiKey = PRIVATE_API_KEY | |
const MyFeedID = "220375411" | |
// Class for reading/writing a feed at xively.com (formerly cosm) | |
class XivelyFeed { |
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
// Base class for MCP23008 and MCP23017 family of I2C i/o expanders | |
class MCP230xx { | |
BASE_ADDR = 0x20 | |
i2cPort = null | |
i2cAddr = null | |
regs = null | |
constructor(i2cPort, deviceAddr) { | |
this.i2cPort = i2cPort | |
this.i2cAddr = (BASE_ADDR + deviceAddr) << 1 |
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
// This class is compatible with the general Pin class | |
class MCP23008Pin { | |
device = null | |
gpio = null | |
constructor(device, gpio) { | |
this.device = device | |
this.gpio = gpio | |
} | |
function configure(mode) { |