This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void loop() { | |
switch (state){ | |
case ‘R’: | |
if( isr_flag == 1 ) { | |
delay(5000); | |
detachInterrupt(0); | |
handleGesture(); | |
digitalWrite(9, LOW); | |
isr_flag = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mraa | |
import time | |
# I2C Globals | |
bus = mraa.I2c(1) | |
bus.address(0x27) | |
while True: | |
# Read from sensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Battery Babysitter Demo | |
* June 22, 2016 | |
* | |
* RGB LED changes colors based on LiPo state of charge | |
* | |
* Hardware: | |
* Babysitter | LED (Common Anode) | Arduino | |
* -------------|---------------------|--------- | |
* GND | | GND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() { |
OlderNewer