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
int led = 13; | |
void setup() { | |
pinMode(led, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(led, HIGH); | |
delayMicroseconds(1); | |
digitalWrite(led, LOW); |
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
const int phase1pin = 2; | |
const int phase2pin = 4; | |
const int phase3pin = 3; | |
float holdTime = 50000; // microsecs | |
const unsigned long minHoldTime = 10000; | |
unsigned long p1start, | |
p1end, | |
p2start, | |
p2end, |
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
function googleFormsService ($q, $rootScope, jQuery) { | |
angular.extend(this, { | |
/** | |
* Sends a response using Google Forms AJAX API (informal) | |
* @param {String} formKey The key of the form, e.g. 15QFO2VE44-9gAwcJeTPPWvxAX7v_1Ye9qmjdX2VzLBw | |
* @param {Object} values A list of key-value pairs to send as the form data, e.g. {'entry.6939333': 'John', 'entry.7399349': Due} | |
* @returns {*} Promise that will be resolved after the form request has been submitted | |
*/ | |
sendResponse(formKey, values) { | |
var deferred = $q.defer(); |
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
#include <Adafruit_NeoPixel.h> | |
#define NUM_PIXELS 24 | |
Adafruit_NeoPixel pixels(NUM_PIXELS, D2, NEO_GRB | NEO_KHZ800); | |
void setup() { | |
pixels.begin(); | |
} |
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
#! /bin/sh | |
wget http://rogueamoeba.com/airfoil/download/AirfoilSpeakersLinux.all.deb | |
wget http://rogueamoeba.com/airfoil/download/AirfoilSpeakersRaspberryPi.tgz | |
sudo dpkg -i AirfoilSpeakersLinux.all.deb | |
sudo apt-get install -f | |
tar zxf AirfoilSpeakersRaspberryPi.tgz | |
sudo cp -p ./airfoilspeakers/lib/*ARM.so /usr/lib/airfoilspeakers | |
airfoilspeakers |
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
#include <FastGPIO.h> | |
#define APA102_USE_FAST_GPIO | |
#include <APA102.h> | |
APA102<11, 12> ledStrip; | |
const uint16_t ledCount = 144; | |
rgb_color pixels[ledCount]; | |
void setup() { |
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
function startLoop(char) { | |
console.log('Connected !'); | |
setInterval(function() { | |
var t = ngbeacon.temperature(); | |
console.log(t); | |
var r = t > 22 ? 0xff : 0, | |
g = 0, | |
b = t > 22 ? 0 : 0xff; | |
char.writeValue(new Uint8Array([0x56, r, g, b, 0, 0xf0, 0xaa])); | |
}, 1000); |
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
function updateValues() { | |
var temperature = new Uint16Array([ngbeacon.humidity() * 100]); | |
var humidity = new Uint16Array([ngbeacon.humidity() * 100]); | |
NRF.updateServices({ | |
0x181A: { | |
0x2A6E: { value: temperature.buffer, notify: true }, | |
0x2A6F: { value: humidity.buffer, notify: true } | |
} | |
}); | |
} |
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
for (let i = 0; i < 0x80; i++) { | |
try { I2C1.readFrom(i, 1); console.log(i); } catch (e) {} | |
} |
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 bulbDevice = null; | |
var bulbChar = null; | |
function setColor(r, g, b) { | |
try { | |
bulbChar.writeValue(new Uint8Array([0x56, r, g, b, 0, 0xf0, 0xaa])); | |
} catch (e) { | |
} | |
} |