Skip to content

Instantly share code, notes, and snippets.

View don's full-sized avatar

Don Coleman don

View GitHub Profile
/*
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 / 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);
@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>
#!/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 / 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;
#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 / 01_CentralManager.m
Last active August 29, 2015 14:24
iOS Bluetooth Low Energy Central
_central = [[CBCentralManager alloc]
initWithDelegate:self
queue:nil
options:nil];
@don
don / 01_CreateBeacon.m
Last active August 29, 2015 14:24
iOS iBeacon
_peripheralManager = [[CBPeripheralManager alloc]
initWithDelegate:self
queue:nil];
NSUUID *uuid = [[NSUUID alloc]
initWithUUIDString:@"12345678-AAAA-BBBB-CCCC-123456789ABC"];
_region = [[CLBeaconRegion alloc]
initWithProximityUUID:uuid
major:1
# parse the duration of a FLV file from the metadata
def duration(file_name)
return -1 unless FileTest.exist?(file_name)
metadata = File.open(file_name, 'rb') do |file|
file.read(400) # bytes
end
offset = metadata =~ /duration/
@don
don / index.js
Created September 11, 2015 19:01
Cordova BLE Notify Test using bleno's Test service
// Cordova project to test BLE notifications
// Run the test service on OS X or Linux with Node.js
// http://bit.ly/bleno-test-service
// characteristic ffffffff-ffff-ffff-ffff-fffffffffff5 will
// increment a counter every 5 seconds notifying this app
// create a new cordova project
// $ cordova create notify com.example.notify Notify
// replace notify/www/js/index.js with this file
// $ cd notify