Monthly Archives: October 2006
Schematic symbols for Illustrator
Here’s a good set of schematic symbols for Illustrator, for those wanting to avoid circuit layout programs. These do a good job, and let you work in a familiar environment.
Continue reading
Sudden Motion Sensor on the Macbook
Dan Shiffman’s written a nice library to access the sudden motion sensor on the macbook and macbook pro…. Below is a code sample for it that draws a plane on the screen and moves it as you tilt the computer. Continue reading
Bluetooth-to-Bluetooth connection using blueSMiRF
by Tom Igoe created 17 Oct. 2006 */ import processing.serial.*; Serial myPort; // the serial connection String responseString = “”; // response from the blueSMiRF String[] responses = new String[20]; // array of strings in case you get a multi-line response int nextLine = 0; // counter for the multi-line response String targetAddress; // BT address of another device to connect to boolean connected = false; // whether you’re connected to another BT device or not void setup() { // set the window size: size(100,100); // print the list of serial ports, to find the one you need: println(Serial.list()); // open the appropriate serial port…. // send any keystrokes through to the remote radio: println(key); myPort.write(key); } } /* btConnect method runs through all the commands necessary to make a connection: */ void btConnect() { // send an AT command, wait for an OK: sendCommand(“AT”, “OK”); // send a clear command, wait for an OK: sendCommand(“ATUCL”, “OK”); // sent an inquiry command for up to 3 devices, wait for a DONE: sendCommand(“ATDI,3,00000000″, “DONE”); // search the array of returned strings for a target address and connect: findTarget(); } /* sendCommand method sends a command and waits for a response: */ void sendCommand(String command, String whatResponse) { // send the command: myPort.write(command+ “\r”); // wait for the appropriate response: while (!responseString.equals(whatResponse)) { delay(10); } } /* findTarget looks through the array of received responses for a BT device type of 00000000. Continue reading
Serial Quicktime Movie Controller
by Tom Igoe Created 8 Oct. 2006 Modified: */ import processing.serial.*; import processing.video.*; Serial myPort; // The serial port int sensorValue; // value of the byte received Movie myMovie; // variable to store an instance of the movie library float movieDuration; // duration of the movie you’re using void setup() { // set the window size: size(200,200); // List all the available serial ports println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Arduino module, so I open Serial.list()[0]…. Place it in a folder called “Data” // inside your sketch folder: myMovie = new Movie(this, “station.mov”); myMovie.loop(); // get the movie duration: movieDuration = myMovie.duration(); } void draw() { background(0); // if there’s a movie to read, read it: if(myMovie.available()) { myMovie.read(); } // calculate the movie position based on the value from the sensor. Continue reading