Skip to content

Instantly share code, notes, and snippets.

View sandeepmistry's full-sized avatar

Sandeep Mistry sandeepmistry

View GitHub Profile
@sandeepmistry
sandeepmistry / yun.js
Created February 11, 2014 00:30
Arduino Yun: bleno + johnny-five
var util = require('util');
var bleno = require('bleno');
var five = require("johnny-five");
var BlenoPrimaryService = bleno.PrimaryService;
var BlenoCharacteristic = bleno.Characteristic;
var BlenoDescriptor = bleno.Descriptor;
var board = new five.Board({
@sandeepmistry
sandeepmistry / mwc-challenge-2014.js
Created February 12, 2014 00:26
node.js script to mimic the iBeacons at Mobile World Congress 2014 - http://mwc.mobisfera.com
var bleno = require('bleno');
var uuid = 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'.replace(/-/g, '');
var major = 21047;
var minorStart = 0;
var minorEnd = 5;
var measuredPower = -59;
console.log("MWC Scavenger Hunt");
@sandeepmistry
sandeepmistry / uri-beacon-test.js
Last active August 29, 2015 14:20
node URI Beacon Scanner
var UriBeacon = require('./uri-beacon');
UriBeacon.on('discover', function(uriBeacon) {
console.log('discovered: ' + JSON.stringify(uriBeacon, null, 2));
});
UriBeacon.startScanning();
@sandeepmistry
sandeepmistry / gist:5288912
Created April 2, 2013 00:16
Modified test2.js from @mrose17
var noble = require('noble');
var main = function() {
noble.on('stateChange', function(state) {
console.log('stateChange: ' + state);
if (state === 'poweredOn') noble.startScanning(); else noble.stopScanning();
});
noble.on('peripheralDiscover', function(peripheral) {
@sandeepmistry
sandeepmistry / output.txt
Created April 7, 2013 12:13
dbus-native BlueZ unmarshall error
{ name: '/',
service:
{ name: 'org.bluez',
bus:
{ connection: [Object],
serial: 2,
cookies: [Object],
methodCallHandlers: {},
signals: [Object],
exportedObjects: {},
@sandeepmistry
sandeepmistry / humidity.js
Last active December 20, 2015 05:09
node.js TI SensorTag humidity sensor example.
var SensorTag = require('sensortag');
SensorTag.discover(function(sensorTag) {
console.log('discover');
sensorTag.connect(function() {
console.log('connect');
sensorTag.discoverServices(function() {
console.log('discoverServices');
sensorTag.discoverCharacteristics(function() {
console.log('discoverCharacteristics');
/*
This example connects to a WPA encrypted WiFi network,
using the WiFi Shield 101.
Then connects to the Arduino Cloud MQTT broker using
SSL, and sends updates on the status of an LED which
is controlled by a button.
Circuit:
* WiFi shield attached
@sandeepmistry
sandeepmistry / advertisement-discovery.js
Last active July 17, 2018 19:50
noble scan, and advertisement info print out on discovery.
var noble = require('noble');
noble.on('stateChange', function(state) {
if (state === 'poweredOn') {
noble.startScanning();
} else {
noble.stopScanning();
}
});
@sandeepmistry
sandeepmistry / BLEPeripheral_NeoPixel.ino
Created March 25, 2015 23:14
BLEPeripheral + NeoPixel
// Import libraries (BLEPeripheral depends on SPI)
#include <SPI.h>
#include <BLEPeripheral.h>
#include <Adafruit_NeoPixel.h>
// define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9