Skip to content

Instantly share code, notes, and snippets.

View don's full-sized avatar

Don Coleman don

View GitHub Profile
#include <Encoder.h>
Encoder encoder(3,4);
// Import libraries (BLEPeripheral depends on SPI)
#include <SPI.h>
#include <BLEPeripheral.h>
#define BLE_REQ 9
#define BLE_RDY 8
#define BLE_RST 5
@don
don / 0_init.m
Last active August 29, 2015 14:18
Code for ETE 2015 presentation
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
NSUUID *uuid = [[NSUUID alloc]
initWithUUIDString:@"01122334-4556-6778-899A-ABBCCDDEEFF0"];
CLBeaconRegion *region = [[CLBeaconRegion alloc]
initWithProximityUUID:uuid identifier:@"iBeacon"];
region.notifyOnEntry = TRUE;
#!/usr/bin/env python
import io
import sys
import serial
import random
from time import sleep
from serial.tools.list_ports import comports
filename = sys.argv[0]
@don
don / rfduino_matrixtest.ino
Created November 9, 2014 23:01
RFduino NeoMatrix NeoPixel Scrolling
// NeoMatrix test on RFduino
// Based on https://github.com/adafruit/Adafruit_NeoMatrix/blob/master/examples/matrixtest/matrixtest.pde
// Requires https://github.com/don/Adafruit_NeoPixel/tree/tolson
// This version does not enable Bluetooth and it works fine
#include <RFduinoBLE.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
@don
don / NeoPixelNFC_P2P.ino
Created September 21, 2014 01:43
Receive a NDEF message from a Peer & Light NeoPixel LEDs http://makerfaire.com/makers/arduino-nfc-3/
// Receive a NDEF message from a Peer
// Requires SPI. Tested with Seeed Studio NFC Shield v2
#include "SPI.h"
#include "PN532_SPI.h"
#include "snep.h"
#include "NdefMessage.h"
PN532_SPI pn532spi(SPI, 10);
SNEP nfc(pn532spi);
/*
Advertise a URL in the (
*/
#include <RFduinoBLE.h>
// the advertisement packet is composed of a series of variable length blocks, that can appear in any order.
// each block starts with a length byte, followed by a type byte, followed by the data.
// the payload cannot exceed 31 bytes.
// Note: since the RFduino UUID is missing from the advertisement packet, the RFduino iPhone apps will not
@don
don / ces_scavenger_hunt.js
Created January 3, 2014 23:07
Emulate iBeacons with NodeJS for the CES Scavenger Hunt App http://makezine.com/2014/01/03/hacking-the-ces-scavenger-hunt/
var bleno = require('bleno'),
uuid = '842AF9C408F511E39282F23C91AEC05E',
major = 65000,
minor = 65000,
measuredPower = -59;
var intervalId = setInterval(function() {
bleno.stopAdvertising();
minor++;
if (minor > 65009) {
/*
This RFduino sketch demonstrates a full bi-directional Bluetooth Low
Energy 4 connection between an iPhone application and an RFduino.
This sketch works with the rfduinoLedButton iPhone application.
The button on the iPhone can be used to turn the green led on or off.
The button state of button 1 is transmitted to the iPhone and shown in
the application.
*/
@don
don / ninja-thing.js
Created December 5, 2013 22:45
Node script to poll the Ninja Blocks cloud server and send the information to The Thing System. For a Ninja Block Driver see https://github.com/don/ninja-thing
// Send Ninja Block Device info to The Thing System via TSRP
//
// This script polls the ninja cloud to fetch device information
//
// $ node ninja-thing.js
//
// (c) 2013 Don Coleman
/* jshint unused: vars, camelcase: false */
'use strict';
<script type="text/javascript">
window.console = {
log: function (str) { window.external.Notify(str); }
};
// output errors to console log
window.onerror = function (e) {
console.log("window.onerror ::" + JSON.stringify(e));
};