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
// Print light reading trigger URL | |
server.log("Sensor Agent URL: " + http.agenturl()); | |
// Define funtions | |
function requestHandler(request, response) | |
{ | |
// Handle an incoming web request for a reading | |
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
// Log the URLs we need | |
server.log("Print message x: " + http.agenturl() + "?message=x&inv=1"); | |
function requestHandler(request, response) | |
{ | |
try | |
{ | |
// check if the user sent 'print' as a query parameter | |
if ("inv" in request.query) device.send("ts.led.inverse", request.query.inv); |
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 one_wire_reset() | |
{ | |
// Configure UART for 1-Wire RESET timing | |
ow.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS) | |
ow.write(0xF0) | |
ow.flush() | |
if (ow.read() == 0xF0) | |
{ | |
// UART RX will read TX if there's no device connected |
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 one_wire_reset() | |
{ | |
// Configure UART for 1-Wire RESET timing | |
ow.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS) | |
ow.write(0xF0) | |
ow.flush() | |
if (ow.read() == 0xF0) | |
{ | |
// UART RX will read TX if there's no device connected |
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
// Nokia 5110 control code for the imp | |
// Adapted by Tony Smith from a variety of sources: | |
// http://playground.arduino.cc/Code/PCD8544 | |
// http://www.microsyl.com/index.php/2010/03/24/nokia-lcd-library/ | |
// Assign the control pins to global variables | |
PIN_RST <- hardware.pin9; | |
PIN_CE <- hardware.pin8; | |
PIN_DC <- hardware.pin7; |
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
// ADXL345 Register Values | |
const DEVICE_ID = 0x00; // Device ID register | |
const POWER_CTL = 0x2D; // Power Control register | |
const DATA_FORMAT = 0x31; // Data storage format register | |
const DATAX0 = 0x32; //X-Axis Data 0 | |
const DATAX1 = 0x33; //X-Axis Data 1 | |
const DATAY0 = 0x34; //Y-Axis Data 0 | |
const DATAY1 = 0x35; //Y-Axis Data 1 | |
const DATAZ0 = 0x36; //Z-Axis Data 0 |
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
class SSD1306_OLED | |
{ | |
// 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 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 BMP180_Sensor | |
{ | |
// Squirrel Class for Bosch BMP180 Temperature and Pressure Sensor | |
// [http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf] | |
// As used on the Adafruit BMP180 breakout board | |
// [http://www.adafruit.com/products/1603] | |
// Bus: I2C | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0 |
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
// Constants for the alphanumeric character set | |
static charset = [ | |
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00], // Space - Ascii 32 | |
[0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00], // ! | |
[0x00,0x24,0x24,0x00,0x00,0x00,0x00,0x00], // ” | |
[0x00,0x24,0x7E,0x24,0x24,0x7E,0x24,0x00], // # | |
[0x00,0x08,0x3E,0x28,0x3E,0x0A,0x3E,0x08], // $ | |
[0x00,0x62,0x64,0x08,0x10,0x26,0x46,0x00], // % | |
[0x00,0x10,0x28,0x10,0x2A,0x44,0x3A,0x00], // & |
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
// Squirrel Class for accessing 1-Wire devices, eg. | |
// Maxim Integrated DS18B20 temperature sensor | |
// [http://www.maximintegrated.com/datasheet/index.mvp/id/2812] | |
// via two-wire UART. The imp does not support 1-Wire natively | |
// Bus: UART | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0 | |
OlderNewer