Skip to content

Instantly share code, notes, and snippets.

View soundanalogous's full-sized avatar

Jeff Hoefs soundanalogous

  • San Francisco, CA
View GitHub Profile

Building an ultrasonic sensor backpack

Note: This is a bit of a scratch to see what's involved in getting the ping sensor to work as an I2C backpack.

Dependencies.

I did this on a Trinket as that's what I had to hand to make programming a bit faster. If you use a trinket you will need the custom arduino. Check out the Adafruit Trinket info https://learn.adafruit.com/introducing-trinket/introduction

You also need a custom form of the TinyWireS library that manages sending multiple registers on one read request (the

@soundanalogous
soundanalogous / StandardFirmataMemCheck.ino
Last active November 27, 2016 00:11
StandardFirmata with memory reporting
/*
* Dependencies:
* - This code depends on the ArduinUnit library. Get it here:
* https://github.com/mmurdoch/arduinounit and copy it to your
* Arduino libraries folder.
* - You must use a Firmata client library that has the STRING_DATA
* message implemented (node-firmata, johnny-five, BreakoutJS)
*
* Copy this into a new Arduino file, compile and upload.
* It will report the available memory approximately every 10 seconds.
@soundanalogous
soundanalogous / bma250
Created March 29, 2014 19:33
BMA250 example
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
body {
margin: 15px;
font-family: sans-serif;
@soundanalogous
soundanalogous / AccelerometerBMA250
Last active August 29, 2015 13:57
Experimental BMA250 module for Breakout.js
/**
* Copyright (c) 2011-2014 Jeff Hoefs <[email protected]>
* Released under the MIT license. See LICENSE file for details.
*/
JSUTILS.namespace('BO.io.AccelerometerBMA250');
/**
* @namespace BO.io
*/
// treat the scope as read-only in views
// treat the scope as write-only in controllers
/**
* use attrs to read from scope
*/
<div my-attribute="propName">
app.directive('myDirective', function () {
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello World</title>
</head>
<body>
<button id="ledToggle">Toggle LED</button>
<p id="btnStatus"></p>
<script src="../../dist/Breakout.js"></script>
@soundanalogous
soundanalogous / jquery.ba-tinypubsub.js
Created October 1, 2012 21:15 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
// BIND FIX FOR OLDER BROWSERS
if( Function.prototype.bind ) {
} else {
/** safari, why you no bind!? */
Function.prototype.bind = function (bind) {
var self = this;
return function () {
var args = Array.prototype.slice.call(arguments);
return self.apply(bind || null, args);
};