Content tagged with processing

CALL: Games for 5 Joysticks

TELIC Arts Exchange is putting out a call for games that are designed for 5 joysticks.
(We have a homemade system for playing the games that you can see here) Submissions will be due by Election Day 2006. Selected games will be initially exhibited as an event in November (a video game screening, if that's the right word).

Categories: | | |

Signals and Filters

Some code to play with signals and filters, as seen in Desma256:

analogIn2_toSerialOut_Arduino.zip:
You need to install this code on your arduino board.
It will read from analog input 2 and send the signal out via serial formatted properly for the following 2 apps.

SerialOscilloscope.zip:
This processing app will read the serial signal from arduino and draw both the raw signal data and a low pass filtered version. This is a pretty simple app intended to demonstrate a very simple approach to low pass filtering.

Categories: | | | | |

Processing tutorial: Read button presses from Arduino

import processing.serial.*;

Serial port; // The serial port

void setup() {
size(200, 200);
println(Serial.list()); // list all available serial ports
port = new Serial(this, Serial.list()[2], 19200); // initialize serial communication
}

void draw() {
background(0);
while (port.available() > 0) { // while there are bytes available to read from the serial port
int inByte = port.read(); // read the byte
if (inByte==0) {
fill(255);
rect(width/4,height/4,width/2,height/2);
}
}
}

Categories: | | | |

Processing tutorial: Send data from program to Arduino


import processing.serial.*;

Serial port; // The serial port

void setup() {
size(200, 200);
println(Serial.list()); // list all available serial ports
port = new Serial(this, Serial.list()[2], 19200); // initialize serial communication
}

void draw() {
background(0);
if (mouseX>=width/4 && mouseX<=3*width/4 && mouseY>=height/4 && mouseY<=3*height/4) { // if the mouse is over the square
fill(0,255,0);
port.write(1); // write a 1 to the serial port
} else {
fill(255);
port.write(0); // write a 0 to the serial port (note: this is inefficient because we'll send lots of redundant data to the serial port... try to only do it when we're going to send a new value!)

Categories: | | |