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 "ConnectionManager.lib.nut:3.1.1" | |
#require "MessageManager.lib.nut:2.4.0" | |
class MyConnectionManager extends ConnectionManager { | |
// Attempts to connect. If the server is already connected, or the | |
// connection attempt was successful, run the onConnect handler, and | |
// any other onConnected tasks | |
function connect() { |
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("AGENT RUNNING..."); | |
// Setup listener for device side ping | |
device.on("dPing", function(pingStart) { | |
// Send pong back to device with the starting timestamp | |
device.send("dPong", pingStart); | |
}) | |
device.on("aPong", function(pingStart) { | |
local now = date(); |
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
// iBeacon Bi-Directional Device Application | |
// Map hardware pins to global variables | |
BLE_REG_ON <- hardware.pinJ; | |
BLE_LPO <- hardware.pinE; | |
BLE_UART_TX <- hardware.pinF; | |
BLE_UART_RX <- hardware.pinG; | |
BLE_UART <- hardware.uartFGJH; | |
// BLE FIRMWARE |
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
// The MCP2515 has three transmit and two receive | |
// buffers, two acceptance masks (one for each receive | |
// buffer) and a total of six acceptance filters. Figure 1-3 | |
// shows a block diagram of these buffers and their | |
// connection to the protocol engine. | |
// TX Buffer addresses | |
const MCP2515_TX_BUFF_0_CTRL_REG = 0x30; | |
const MCP2515_TX_BUFF_1_CTRL_REG = 0x40; | |
const MCP2515_TX_BUFF_2_CTRL_REG = 0x50; |
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
function update() { | |
server.log("in update") | |
} | |
// When the device reconnects, send it power and a holding pattern. | |
device.on("status", function (status) { | |
device.send("setPower", 100); | |
device.send("setSpeed", 4); | |
if (status == "boot") { | |
device.send("pushQueue", {"message": "26.35"}); |
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
// CONTROL PHASE | |
// -------------------------------------------------- | |
// BLOCK SELECT BITS | |
const W5500_COMMON_REGISTER = 0x00; | |
const W5500_S0_REGISTER = 0x08; | |
const W5500_S0_TX_BUFFER = 0x10; | |
const W5500_S0_RX_BUFFER = 0x18; |
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
local global_this = this; | |
class Test { | |
var1 = null; | |
var2 = null; | |
timer = null; | |
test_this = null; | |
constructor(one, two) { |
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
The MIT License (MIT) | |
Copyright (c) 2015 Electric Imp | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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 "Firebase.class.nut:1.0.0" | |
///////// Application Code /////////// | |
// VARIABLES | |
agentID <- split(http.agenturl(), "/").pop(); | |
// INITIALIZE CLASS |
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 "rocky.class.nut:1.2.2" | |
#require "Twitter.class.nut:1.2.0" | |
const API_KEY = ""; | |
const API_SECRET = ""; | |
const AUTH_TOKEN = ""; | |
const TOKEN_SECRET = ""; | |
html <- @" | |
<!DOCTYPE html> |