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;
@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 / 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 / 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 / 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() {
@ShawnHymel
ShawnHymel / micro_bit_01_my_name.py
Created August 9, 2016 03:36
micro:bit Tutorial Series Part 1: Getting Started - My Name
from microbit import *
while True:
display.scroll("Shawn")
@ShawnHymel
ShawnHymel / pwm_mux.ino
Created August 16, 2016 16:44
Control 8 LEDs using a multiplexer
/**
* 8-Channel Multiplexer Demo
* August 16, 2016
* License: Public Domain
*
* Show PWM on 8 LEDs using 4 I/O pins and an analog input to
* adjust the PWM period.
*
* Hardware:
* Mux | Trimpot | Arduino
@ShawnHymel
ShawnHymel / micro_bit_02_faces.py
Created August 23, 2016 03:45
Have the micro:bit show a happy face when A is pressed, a sad face when B is pressed, and a meh face when no buttons are pressed.
from microbit import *
while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
elif button_b.is_pressed():
display.show(Image.SAD)
else:
display.show(Image.MEH)
@ShawnHymel
ShawnHymel / micro_bit_02_A_and_B.py
Created August 23, 2016 03:53
Shows a happy face by default but scrolls "A" when A is pressed and "B" when B is pressed
from microbit import *
while True:
if button_a.is_pressed():
display.scroll("A")
elif button_b.is_pressed():
display.scroll("B")
else:
display.show(Image.HAPPY)