Skip to content

Instantly share code, notes, and snippets.

View don's full-sized avatar

Don Coleman don

View GitHub Profile
@don
don / gen_keywords.pl
Last active May 7, 2018 14:25
@bjepson keyword.txt generation script for Arduino libraries
#!/usr/bin/perl -w
# Run this from the Arduino library directory to generate keywords.txt
# Optionally pass the name of the library as the first argument
# $ gen_keywords.pl Foo > keywords.txt
use strict;
my $in_public = 0;
@don
don / ndef_push.ino
Last active December 19, 2015 06:39
/**
* P2P NDEF Push
* requires http://www.seeedstudio.com/depot/nfc-shield-v20-p-1370.html
* and https://github.com/Seeed-Shield/NFC_Shield_DEV
* simplified example based on examples/nfc_ndef_push_url
*/
#include <PN532.h>
#include <NFCLinkLayer.h>
#include <SNEP.h>
#include <NdefMessage.h>
@don
don / ArduinoNFC.ino
Last active December 23, 2015 16:59
Arduino sketch for NY Maker Faire 2013 http://makerfaire.com/makers/arduino-nfc/
/*
Seeed Studio (or Adafruit) NFC Shield
Adafruit 60 LED NeoPixel Strip
Arduino Uno
NFC tag should be TNF MIME_MEDIA and Type text/led
Payload should have RGB color as 0,0,255
*/
#if 1
@don
don / gist:6772141
Last active December 24, 2015 08:39
Install nodejs on BeagleBone Black
<1> download node
<2> install it in +/usr/local+
<3> make symlinks (aliases) to node and npm so you can call them from the command line easily.
$ cd ~/downloads
$ curl -O http://nodejs.org/dist/v0.10.12/node-v0.10.12-linux-arm-pi.tar.gz <1>
$ cd /usr/local
$ sudo tar xzf ~/downloads/node-v0.10.12-linux-arm-pi.tar.gz <2>
$ cd bin
$ sudo ln -s ../node-v0.10.12-linux-arm-pi/bin/node <3>
<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));
};
@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';
/*
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 / 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) {
/*
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);