Skip to content

Instantly share code, notes, and snippets.

Avatar

Shawn Hymel ShawnHymel

View GitHub Profile
View gist:65cd4c1c1bbb097ab62e
void loop() {
switch (state){
case ‘R’:
if( isr_flag == 1 ) {
delay(5000);
detachInterrupt(0);
handleGesture();
digitalWrite(9, LOW);
isr_flag = 0;
View read_temp.py
import mraa
import time
# I2C Globals
bus = mraa.I2c(1)
bus.address(0x27)
while True:
# Read from sensor
@ShawnHymel
ShawnHymel / bleno_error.txt
Created Nov 28, 2015
npm install bleno output
View bleno_error.txt
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 Feb 11, 2016
Getting Started with Intel Edison - Part 7
View main.js
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 Feb 11, 2016
Getting Started with Intel Edison - Part 8
View app.js
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() {
View SimpleServer.js
/**
* 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 Aug 24, 2021
Sample Arduino code for the SST Liquid Level Sensor
View LiquidLevelSensor.ino
// 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 Jun 3, 2016
Sample Arduino code for the Beefcake Relay
View BeefcakeRelay.ino
// 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 Dec 6, 2019
Battery Babysitter Demo
View BatteryBabysitter_Demo.ino
/**
* 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 Jul 5, 2016
Use 2 LEDs to create a photo interrupter
View LED_Photo_Interrupter.ino
#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() {