Skip to content

Instantly share code, notes, and snippets.

View analog-io's full-sized avatar

AnalogIO analog-io

View GitHub Profile
@analog-io
analog-io / browserMqtt.js
Last active January 18, 2022 03:58
browserMqtt.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mqtt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process,global){
'use strict';
/**
* Module dependencies
*/
/*global setImmediate:true*/
var events = require('events'),
Store = require('./store'),
eos = require
exe File path is /Applications/Logic.app/Contents/MacOS/Logic [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 260 ]
exe folder path is /Applications/Logic.app/Contents/MacOS [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 261 ]
Release Mode; analyzer path is /Applications/Logic.app/Contents/Resources/Analyzers [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 283 ]
Release Mode; exe path is /Applications/Logic.app/Contents/MacOS; user path is /Users/lgbeno [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 318 ]
Found log directory at Library//Logs//DiagnosticReports [ /Users/build/ob_logic/Source/Environment.cpp; Environment; 327 ]
[ /Users/build/ob_logic/Source/OsxDevicesManager.cpp; InitializeUsbDevices; 73 ]
[ /Users/build/ob_logic/Source/UsbDevice.cpp; UsbDevice; 62 ]
[ /Users/build/ob_logic/Source/OsxUsbDevice.cpp; OsxUsbDevice; 28 ]
[ /Users/build/ob_logic/Source/OsxUsbDevice.cpp; Init; 79 ]
[ /Users/build/ob_logic/Source/UsbDevice.cpp; IsFi
@analog-io
analog-io / gist:1c1aeaee9a6e9398b699
Created October 27, 2015 16:01
when entering %pylab into jupyter notebook
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4ab7ec3413a5> in <module>()
----> 1 get_ipython().magic('pylab')
/root/anaconda3/lib/python3.4/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2334 magic_name, _, magic_arg_s = arg_s.partition(' ')
2335 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2336 return self.run_line_magic(magic_name, magic_arg_s)
2337
@analog-io
analog-io / BLE_uCurrent.ino
Created August 20, 2015 06:30
An Energia/Arduino sketch for adding BLE readout to an EEVBLOG uCurrent.
#include <analog_io.h>
#include <SPI.h>
analog_io radio(P3_5, P3_6, P2_5);
float ref, I;
float Current;
uint16_t batt,lp_ref;
const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };
@analog-io
analog-io / HopeRF_RX_Test.ino
Last active August 29, 2015 14:26
HopeRF BringUp Code
#include <RF75.h>
#include <SPI.h>
#define PIN_MOSI P1_7
#define PIN_MISO P1_6
#define PIN_CLK P1_5
#define PIN_CE P3_5
#define PIN_nCS P3_6
#define PIN_IRQ P2_5
@analog-io
analog-io / err.log
Created April 28, 2015 20:54
Phant-manager-sparkfun Error
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: Unexpected "x" at position 3 in state START
at Parser.proto.charError (/Users/lgbeno/Documents/node/phant_development/node_modules/phant-manager-sparkfun/node_modules/npm-package-search/node_modules/npm-package-sync/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js:84:16)
@analog-io
analog-io / agent
Created April 12, 2015 01:32
Another MAG3110 test
// Create a data stream at data.sparkfun.com, then enter your keys here:
local publicKey = "x"
local privateKey = "x"
data_array <- array(800,[0,0,0,0])
name_array <- ["x","y","z"]
total <- 0
local req = http.get("https://data.sparkfun.com/output/"+publicKey+"/latest.json");
local response = req.sendsync()
@analog-io
analog-io / si7020_fixed.lua
Created April 10, 2015 15:55
Fixed point Si7020 Math
local rh = read_reg(0x40,0xE5,true)
local t = read_reg(0x40,0xE0,false)
rh = string.byte(rh,1)*256+string.byte(rh,2)
t = string.byte(t,1)*256+string.byte(t,2)
t=(17572*t)/65536-4685
t=tostring(t*18+32000)
rh=tostring(rh*12500/65536-600)
t=t:sub(1,t:len()-3).."."..t:sub(t:len()-2,t:len())
rh=rh:sub(1,rh:len()-2).."."..rh:sub(rh:len()-1,rh:len())
print(t.." : "..rh)
@analog-io
analog-io / MAG3110_electric_imp
Created April 10, 2015 15:51
I2C interface for MAG3110 wirtten for electric imp
// Define the Sensor Address
const ADDR = 0x1C;
// Define register map
const DR_STATUS = "\x00";
const OUT_X_MSB = "\x01";
const OUT_X_LSB = "\x02";
const OUT_Y_MSB = "\x03";
const OUT_Y_LSB = "\x04";
const OUT_Z_MSB = "\x05";
@analog-io
analog-io / si7020.ino
Created April 10, 2015 15:46
si7020 Interface sketch for energia
#include "Energia.h"
#include "I2C_SoftwareLibrary.h"
#define LED RED_LED
#define SCL_PIN P2_6 ///< pin for SCL
#define SDA_PIN P2_7 ///< pin for SDA
SoftwareWire Wire(SDA_PIN, SCL_PIN);
#define _address 0x40
uint8_t id[8];