Skip to content

Instantly share code, notes, and snippets.

View blindman2k's full-sized avatar

Aron Steg blindman2k

View GitHub Profile
/* Environmental Sensor Tail Firmware
* Ambient Light Sensor: APDS-9007-020 (http://www.avagotech.com/docs/AV02-0512EN)
* Air Pressure Sensor: LPS25HTR (http://www.st.com/web/en/resource/technical/document/datasheet/DM00066332.pdf)
* Humidity/Temp Sensor: SI7020-A10-GMR (http://www.silabs.com/Support%20Documents/TechnicalDocs/Si7020.pdf)
*/
const LPS25H_ADDR = 0xB8; // 8-bit I2C Student Address for LPS25HTR
const SI7020_ADDR = 0x80; // 8-bit I2C Student Address for SI7020
const ALS_RLOAD = 47000.0; // load resistor value on ALS
const READING_INTERVAL = 3; // seconds between readings
/* 9 Degrees of Freedom Sensor Tail Firmware
* Uses LSM9DS0 IMU from ST
* http://www.adafruit.com/datasheets/LSM9DS0.pdf
*/
const XM_ADDR = 0x3C; // 8-bit I2C Student Address for Accel / Magnetometer
const G_ADDR = 0xD4; // 8-bit I2C Student Address for Angular Rate Sensor
const READING_INTERVAL = 1; // seconds between readings
/* CLASS AND GLOBAL FUNCTION DEFINITIONS ------------------------------------ */
#require "Rocky.class.nut:1.1.1"
class RockyII extends Rocky {
function _addAccessControl(res) {
res.header("Access-Control-Allow-Origin", "*")
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, PATCH, DELETE");
res.header("Access-Control-Expose-Headers", "X-ImpBase-Version");
}
}
// Copyright (c) 2015 Initial State Technologies, Inc.
// This file is licensed under the MIT License
// http://opensource.org/licenses/MIT
class InitialState {
static version = [1,0,0];
_bucketKey = null;
_accessKey = null;