Skip to content

Instantly share code, notes, and snippets.

@jbinkleyj
jbinkleyj / thing.js
Last active August 29, 2015 14:08 — forked from cowboy/thing.js
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);
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
var processing2 = (function(global) {
var exports = {};
exports.drawCircle = function() {
// something
};
exports.setColor = function() {
// something
};
@jbinkleyj
jbinkleyj / exit.js
Last active August 29, 2015 14:08 — forked from cowboy/exit.js
// 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();
}
}
var EventEmitter = require('events').EventEmitter;
var es = require('event-stream');
var util = require('util');
function Logger() {
Logger.super_.call(this);
}
util.inherits(Logger, EventEmitter);
#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);
/*
* 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
/*
* 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
/*
* 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
/*
* 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