//Holmes 2005 demo
//sample serial for EZIO push button
//switch attached to Digital in line 1

 

int p1;
void setup() {
size(200,200);
background(0);
beginSerial(57600);
// Default start serial at 57000 baud
}
void loop() {
serialWrite(114);
//send an R ASCII-114
serialWrite(0);
//send an 0 to read port 1
rect(0,0,width, height);
//draw a rect
if(p1==1){
fill(5,255,0);
//if the switch is closed fill green
}else{
fill(255,0,0);
//if the switch is open fill red
}
}
void serialEvent() {
p1=serial;
println(p1);
}

 

Class 11: Serial data input for AOS

Steps to prepare your Mac to receive serial data via Lingo or Processing:

1. Download + install the Keyspan 28X driver for the twin serial adapter (or appropriate driver software). Click for Keyspan.

2. If using Lingo, download Ben Chang's EZIOxtra. Place xtra in Director's xtras folder. Test sample movie "on_off.dir" available for download from portal. If movie doesn't work, make sure you read the setup scripts in that movie in frame 1 (commented) and check to make sure your xtra is installed: Modify>Movie>Xtras>Add. Another helpful site for wiring and EZIO info is linked to Michael Rodemer's site at U of M.

3. If using Processing look for the file called "serial_setup.command" (in Processing 68 folder). This app will run some necessary scripts in your Terminal window. Close the Terminal window when scripts have run.

4. If using Processing or Director connect all switches and power on EZIO BEFORE running scripts. NEVER disconnect the EZIO when a movie is running.

5. If using serial for the first time in Processing you (after running the serial_setup app) go to Sketch>Serial Port and pick your device. I have my EZIO board connected to port 1 on the twin Keyspan adapter and I selected "/dev/cu.USA28X21P1.1" from that menu.