Interface and Application Programming (Week 15)
The assignment for this week was to design an application that would visualize the input received from the input board designed in Week 10.
I designed a temperature sensor as part of Week 10’s assignment and my experience with the same can be read here.
Since I wasn’t able to visualise the circuit using PySerial I thought of trying to program it using Processing. But no luck here either.
I followed the instruction as listed on AS220 and used the laptop touch pad as the input device to write processing code and visualise the output.
The Code :
void setup() {
size(640, 360);
background(102);
}
void draw() {
// Call the variableEllipse() method and send it the
// parameters for the current mouse position
// and the previous mouse position
variableRect(mouseX, mouseY, pmouseX, pmouseY);
}
void variableRect(int x, int y, int px, int py) {
float speed = abs(x-px) + abs(y-py);
stroke(speed);
rect(x, y, speed, speed);
}
The video of the visualisation can be accessed here.