Skip to content

Instantly share code, notes, and snippets.

View don's full-sized avatar

Don Coleman don

View GitHub Profile
@don
don / eddystone.ino
Last active April 18, 2017 23:02
ETE 2017
#include <SPI.h>
#include <EddystoneBeacon.h>
EddystoneBeacon eddystoneBeacon = EddystoneBeacon();
void setup() {
// power, URI
eddystoneBeacon.begin(-18, "https://example.com");
}
var midiService = {
uuid: MIDI_SERVICE_UUID,
characteristics: [
{
uuid: MIDI_CHARACTERISTIC_UUID,
properties: property.WRITE | property.READ | property.NOTIFY,
permissions: permission.WRITEABLE | permission.READABLE,
descriptors: [
{
uuid: '2901',
@don
don / onerror.js
Created February 10, 2017 01:13
Global error handler for debugging with PhoneGap Developer App
// https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror
window.onerror = function (msg, url, lineNo, columnNo, error) {
var string = msg.toLowerCase();
var substring = "script error";
if (string.indexOf(substring) > -1){
alert('Script Error: See Browser Console for Detail');
} else {
var message = [
'Message: ' + msg,
'URL: ' + url,
@don
don / BroadcastCount.ino
Last active January 26, 2018 06:06
Demonstrate BLE broadcast for connectionless data transfer
// Broadcast Characteristic Value
// Simple counter that broadcasts a value
#ifdef ARDUINO_ARCH_ARC32 // Arduino 101
#include <CurieBLE.h>
#else
#include <BLEPeripheral.h>
#endif
uint8_t value = 0;
// Port Arduino BLE button demo to Puck-js
// https://github.com/don/ITP-BluetoothLE/blob/master/arduino/Button_v2/Button_v2.ino
NRF.setServices({
0xFFE0 : {
0xFFE1 : {
value: 0,
readable: true,
notify: true
}
@don
don / sample-arduino-101-notify-random.ino
Last active July 13, 2016 00:40 — forked from dkarchmer/sample-arduino-101-notify-random.ino
Sample Arduino 101 code advertising BLE characteristic with 'BLERead | BLENotify'
//Sample using LiquidCrystal library
//#include <LiquidCrystal.h>
#include <CurieBLE.h>
// select the pins used on the LCD panel
//LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
@don
don / index.js
Created February 17, 2016 16:59
BluetoothSerial counter showing count and raw data
var macAddress = "00:13:EF:00:08:8B";
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
@don
don / BLE_Workshop_Software_Install.md
Last active January 21, 2016 04:09
Software Install instructions for the PhoneGap Day 2016 - Hands on Bluetooth LE Workshop

Hands-on Bluetooth Low Energy

PhoneGap Day - January 28th, 2016

Software Installation

In order to get the most of the class, we're asking everyone to install the software before the workshop.

It's important that you follow this guide and have you computer setup before you arrive. We want to spend time learning about Bluetooth not installing software.

PhoneGap

@don
don / P2P_Send_LongRecord.ino
Created December 9, 2015 04:17
Writing large Peer to Peer NFC messages from Arduino
// Sends a NDEF Message to a Peer
// Requires SPI. Tested with Seeed Studio NFC Shield v2
#include "SPI.h"
#include "PN532_SPI.h"
#include "snep.h"
#include "NdefMessage.h"
#define TEXT_SIZE 226
#define LANGUAGE_ENCODING_SIZE 3
@don
don / main.js
Last active December 1, 2015 19:21
Bleno with Eddystone beacon
var bleno = require('bleno');
var util = require('util');
var os = require('os');
var eddystone = require('eddystone-beacon');
var BlenoPrimaryService = bleno.PrimaryService;
var BlenoCharacteristic = bleno.Characteristic;
// Characteristic