Schlagwort-Archive: Processing
the first try to control a screen application with a potentiometer- connecting arduino and processing
this is an example of the graph we created
First we uploaded the standardFirmamenta on the arduino board.
Then we wrote the following code in processing:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int INPUT_PIN = 0;
int xPos = 1; // horizontal position of the graph
void setup () {
// set the window size:
size(400, 300);
arduino = new Arduino(this, Arduino.list()[0], 57600);
for (int i = 0; i <= 13; i++) {
arduino.pinMode(i, Arduino.INPUT);
}
// set inital background:
background(0);
}
void draw () {
// convert to an int and map to the screen height:
float value = float(arduino.analogRead(INPUT_PIN));
value = map(value, 152, 1023, height, 0);
// draw the line:
stroke(127, 34, 255);
line(xPos, height, xPos, value);
// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
Ani – An animation library for Processing
An animation library by Benedikt Groß for the programming environment Processing. Last update, 2011/09/27.
Ani 2.0 is a lightweight library for creating animations and transitions. Easily spoken Ani helps you to move things around on the screen or a bit more abstract, to animate any numeric variable.
P R O C E S S I N G.org
Social Coding – share codes, find codes, get help by Pro’s 😉
http://www.openprocessing.org/
A lot of codes and libraries…and a BOOK! Check the shelves in the eLab!
http://www.generative-gestaltung.de/
Same story: try the examples! (BTW there is also the function for „fullscreen“)