Skip to content

Instantly share code, notes, and snippets.

View ShawnHymel's full-sized avatar

Shawn Hymel ShawnHymel

View GitHub Profile
@ShawnHymel
ShawnHymel / gist:65cd4c1c1bbb097ab62e
Created April 10, 2015 18:52
#670247 Gesture Sketch
void loop() {
switch (state){
case ‘R’:
if( isr_flag == 1 ) {
delay(5000);
detachInterrupt(0);
handleGesture();
digitalWrite(9, LOW);
isr_flag = 0;
import mraa
import time
# I2C Globals
bus = mraa.I2c(1)
bus.address(0x27)
while True:
# Read from sensor
@ShawnHymel
ShawnHymel / bleno_error.txt
Created November 28, 2015 20:41
npm install bleno output
npm WARN optional dep failed, continuing xpc-connection@0.1.4
npm WARN engine node-hid@0.5.1: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.38","npm":"1.4.28"})
npm WARN engine usb@1.1.1: wanted: {"node":">=0.12.x"} (current: {"node":"0.10.38","npm":"1.4.28"})
-
> node-hid@0.5.1 install /home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid
> node-pre-gyp install --fallback-to-build
make: Entering directory '/home/root/bleno-master/node_modules/node-blink1/node_modules/node-hid/build'
CC(target) Release/obj.target/hidapi/hidapi/libusb/hid.o
AR(target) Release/obj.target/hidapi.a
@ShawnHymel
ShawnHymel / main.js
Created February 11, 2016 23:05
Getting Started with Intel Edison - Part 7
var mraa = require('mraa');
var http = require('http');
var port = 4242;
var led = new mraa.Gpio(12, true, true);
led.dir(mraa.DIR_OUT);
var server = http.createServer(function(req, res) {
res.writeHead(200);
@ShawnHymel
ShawnHymel / app.js
Created February 11, 2016 23:10
Getting Started with Intel Edison - Part 8
window.socket = null;
function connect() {
var ip = document.getElementById("ip").value;
var port = document.getElementById("port").value
window.socket = io.connect("http://" + ip + ":" + port);
window.socket.on("connect_error", function() {
@ShawnHymel
ShawnHymel / SimpleServer.js
Last active May 15, 2016 17:49
SimpleServer
/**
* Simple web server based on
* http://expressjs.com/en/starter/hello-world.html
*
* Prerequisites:
* - Node
* - Express (npm install express)
*
* To use, save as a file (e.g. SimpleServer.js) and run with:
* node SimpleServer.js /PATH/TO/WWW/
@ShawnHymel
ShawnHymel / LiquidLevelSensor.ino
Last active August 24, 2021 07:43
Sample Arduino code for the SST Liquid Level Sensor
// Liquid level detection using an SST sensor
//
// When a liquid touches the tip of the sensor,
// an LED at pin 13 turns on.
//
// Hardware:
// Sensor | Arduino
// -------------|---------
// Vs (RED) | 5V
// Out (GREEN) | pin 7
@ShawnHymel
ShawnHymel / BeefcakeRelay.ino
Created June 3, 2016 04:03
Sample Arduino code for the Beefcake Relay
// Turn the Beefcake Relay on for 2 seconds and off for 2 seconds
//
// Hardware:
// Relay Kit | Arduino
// -------------|---------
// 5V | 5V
// CTRL | pin 7
// GND | GND
// Pins
@ShawnHymel
ShawnHymel / BatteryBabysitter_Demo.ino
Last active April 20, 2023 15:13
Battery Babysitter Demo
/**
* Battery Babysitter Demo
* June 22, 2016
*
* RGB LED changes colors based on LiPo state of charge
*
* Hardware:
* Babysitter | LED (Common Anode) | Arduino
* -------------|---------------------|---------
* GND | | GND
@ShawnHymel
ShawnHymel / LED_Photo_Interrupter.ino
Created July 5, 2016 23:25
Use 2 LEDs to create a photo interrupter
#define LED_N_SIDE 2
#define LED_P_SIDE 3
#define EMITTER 12
#define LED 13
#define CAL_N 100
// Global variables
unsigned int threshold = 0;
void setup() {