Skip to content

Instantly share code, notes, and snippets.

long previousMillis = 0; // store last time LED was updated
long interval = 100; // blink interval (milliseconds)
void setup() {
pinMode(2, INPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH); // start with one LED on
/* Ping))) Sensor
This sketch reads a PING))) ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit:
* +V connection of the PING))) attached to +5V
// Introduction to Physical Computing - ITP - NYU
// Fall 2013 - Tom Igoe
// Midterm Project - Color Flute
// Abe Rubenstein + Yu Ji
// ARDUINO
// global variables for raw sensor values
int photo1 = 0; // photoresistor 1 (red)
int photo2 = 0; // photoresistor 2 (green)
// Introduction to Physical Computing - ITP - NYU
// Fall 2013 - Tom Igoe
// Midterm Project - Color Flute
// Abe Rubenstein + Yu Ji
// PROCESSING
import processing.serial.*;
Serial port;
@sighrobot
sighrobot / soundkites.pde
Last active December 30, 2015 20:28
Sound Kites FINAL PCOMP 2013
// Introduction to Physical Computing - ITP - NYU
// Fall 2013 - Tom Igoe
// Final project - Sound Kites
// Abe Rubenstein + Yu Ji
// PROCESSING
import ddf.minim.*;
import processing.serial.*;
Minim minim;
@sighrobot
sighrobot / soundkites.ino
Last active December 30, 2015 20:29
Sound Kites FINAL PCOMP 2013
// Introduction to Physical Computing - ITP - NYU
// Fall 2013 - Tom Igoe
// Final project - Sound Kites
// Abe Rubenstein + Yu Ji
// ARDUINO
// sensor values
int s1 = 0;
int s2 = 0;
int s3 = 0;
@sighrobot
sighrobot / gist:7934521
Created December 12, 2013 20:07
Generates layers of triangles with semi-random dimensions
int i = 0;
int j = 0;
boolean run = true;
void setup() {
background(#ffffff);
size(600, 600);
frameRate(1000);
@sighrobot
sighrobot / datalogger.ino
Last active August 29, 2015 13:57
Solar-Powered Data Logger
/*
* Energy - ITP - NYU
* Spring 2014 - Jeff Feddersen
* Solar challenge - Decibel meter
* Abe Rubenstein
*
* Arduino Uno
* Sparkfun microSD Shield
* Maxim MAX4466 Electret Microphone
*/
@sighrobot
sighrobot / gist:021e620edae4fec28f93
Created November 9, 2014 23:47
Reading XBee API packets from Arduino
#include <AltSoftSerial.h>
AltSoftSerial Xbee; // DOUT -> 8, DIN -> 9
void setup() {
Serial.begin(38400);
Xbee.begin(9600);
}
void loop() {
var levels = 'LEVEL DATA';
var ready= false;
var WebSocket = require('ws'),
ws = new WebSocket('ws://hidden-fortress-3752.herokuapp.com');
ws.on('open', function() {
console.log('open function fired!')
ws.send('Arduino here!' );
ready = true;