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
// ----------------------------------------------------------------------------- | |
// USB Host Shield pinouts | |
// | |
// 1- CS (not sure if it's active high/low) | |
// 2- MISO | |
// 5- SCLK | |
// 7- MOSI | |
// 8- RESET (also not sure about active high/low) | |
// 9- Interrupt (not sure if this is useful for anything) |
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
server.log("Agent started, URL is " + http.agenturl()); | |
//------------------------------------------------------------------------------------------------------------------------------ | |
program <- null; | |
html <- @"<HTML> | |
<BODY> | |
<form method='POST' enctype='multipart/form-data'> |
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
<!DOCTYPE html> | |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Create or test Firebase tokens - by katowulf</title> | |
<script type="text/javascript" src="https:////cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> | |
<script type="text/javascript" src="https://static.firebase.com/v0/firebase.js"></script> | |
<script type="text/javascript" src="https://cdn.firebase.com/v0/firebase-token-generator.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.4.0/moment.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Base64/0.2.0/base64.min.js"></script> |
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
/* | |
* These are the currently supported commands (URLs) | |
* | |
* /device/hardware/pinX/configure (DIGITAL_OUT, DIGITAL_IN, ANALOG_OUT, ANALOG_IN, PWM_OUT) | |
* /device/hardware/pinX/read | |
* /device/hardware/pinX/write | |
* | |
* /device/hardware/X (all hardware.* commands like lightlevel, voltage, etc) | |
* | |
* /device/imp/X (all imp.* commands that take no parameters like getssid, rssi, etc) |
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 Rocky | |
{ | |
_handlers = null; | |
_timeout = 10; | |
// --------------------[ PUBLIC FUNCTIONS ]--------------------------------- | |
// ......................................................................... |
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 is a really simple, reusable wrapper for any internal object to turn it into a class. | |
// For memory and performance reasons, the built-in classes are not real classes so can't | |
// be extended in the normal way. | |
class impWrapper { | |
_wrapped = null; | |
constructor(wrapped) { | |
_wrapped = wrapped; | |
} | |
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 vformat(fmt,...) { | |
local args = [this,fmt]; | |
if (typeof(vargv[0]) == "array") { | |
vargv = vargv[0]; | |
} | |
args.extend(vargv); | |
return format.acall(args); | |
} | |
// ----------------------[ Example use ]---------------------- |
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
server.log("Agent started, URL is " + http.agenturl()); | |
//------------------------------------------------------------------------------------------------------------------------------ | |
program <- null; | |
html <- @"<HTML> | |
<BODY> | |
<form method='POST' enctype='multipart/form-data'> |
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 NeoPixels { | |
// when instantiated, the neopixel class will fill this array with blobs to | |
// represent the waveforms to send the numbers 0 to 255. This allows the blobs to be | |
// copied in directly, instead of being built for each pixel - which makes the class faster. | |
bits = null; | |
// Like bits, this blob holds the waveform to send the color [0,0,0], to clear pixels faster | |
clearblob = null; | |
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
// Pin 2 is the red LED | |
ACTIVITY <- hardware.pin2; | |
ACTIVITY.configure(DIGITAL_OUT); | |
ACTIVITY.write(1); | |
// Pin 8 is the orange LED | |
LINK <- hardware.pin8; | |
LINK.configure(DIGITAL_OUT); | |
LINK.write(1); |