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 Q = require('q'); | |
var util = require('util'); | |
var EventEmitter = require('events').EventEmitter; | |
function MyTask() { | |
EventEmitter.call(this); | |
this._deferred = Q.defer(); | |
this.then = this._deferred.then.bind(this._deferred); // ??? | |
} | |
util.extends(MyTask, EventEmitter); |
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 Processing(options) { | |
this.options = _.extend({}, options); | |
} | |
Processing.prototype.setColor = function(color) { | |
this.color = color; | |
}; | |
Processing.prototype.drawLine = function(x1, y1, x2, y2) { | |
// draw a line using this.options.context and this.color |
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 processing2 = (function(global) { | |
var exports = {}; | |
exports.drawCircle = function() { | |
// something | |
}; | |
exports.setColor = function() { | |
// something | |
}; |
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
// The idea. This doesn't work, but basically comes | |
// from https://github.com/gruntjs/grunt/pull/708 | |
var exitCode; | |
function exit(code) { | |
if (exitCode === undefined) { | |
exitcode = code || 0; | |
tryToExit(); | |
} | |
} |
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 EventEmitter = require('events').EventEmitter; | |
var es = require('event-stream'); | |
var util = require('util'); | |
function Logger() { | |
Logger.super_.call(this); | |
} | |
util.inherits(Logger, EventEmitter); |
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 | |
#define TRIGGER_PIN 12 | |
#define ECHO_PIN 11 | |
#define MAX_DISTANCE 200 | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
void setup() { | |
Serial.begin(9600); |
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
/* | |
* created by Rui Santos, http://randomnerdtutorials.com | |
* | |
* Complete Guide for Ultrasonic Sensor HC-SR04 | |
* | |
Ultrasonic sensor Pins: | |
VCC: +5VDC | |
Trig : Trigger (INPUT) - Pin11 | |
Echo: Echo (OUTPUT) - Pin 12 | |
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
/* | |
* created by Rui Santos, http://randomnerdtutorials.com | |
* | |
* Complete Guide for Ultrasonic Sensor HC-SR04 | |
* | |
Ultrasonic sensor Pins: | |
VCC: +5VDC | |
Trig : Trigger (INPUT) - Pin11 | |
Echo: Echo (OUTPUT) - Pin 12 | |
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
/* | |
* created by Rui Santos, http://randomnerdtutorials.com | |
* Temperature Sensor Displayed on 4 Digit 7 segment common anode | |
* 2013 | |
*/ | |
const int digitPins[4] = { | |
4,5,6,7}; //4 common anode pins of the display | |
const int clockPin = 11; //74HC595 Pin 11 | |
const int latchPin = 12; //74HC595 Pin 12 | |
const int dataPin = 13; //74HC595 Pin 14 |
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
/* | |
* created by Rui Santos, http://randomnerdtutorials.wordpress.com | |
* Control DC motor with Smartphone via bluetooth | |
* 2013 | |
*/ | |
int motorPin1 = 3; // pin 2 on L293D IC | |
int motorPin2 = 4; // pin 7 on L293D IC | |
int enablePin = 5; // pin 1 on L293D IC | |
int state; | |
int flag=0; //makes sure that the serial only prints once the state |