Answer the question
In order to leave comments, you need to log in
How to fix the problem with variables in processing?
There is an arduino with a simple output of a variable to the com port, the program is elementary
int i;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(i);
i++;
}
import processing.serial.*;
Serial myPort;
int val;
PFont font;
void setup()
{
font = loadFont("Rockwell-CondensedBold-48.vlw");
size(720, 1280);
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 9600);
}
void draw()
{
background(0);
textFont(font);
if ( myPort.available() > 0)
{
val = myPort.read();
}
text(val, width/2, height/2);
println(val);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question