We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Why the text inmy code doesn't work?
`
import processing.serial.*;
//Serial port
Serial port;
//Value read from serial
float val;
//value to create x and y axes
int x = 150;
int y = 600;
//value to write intervals x and y axes
int x1;
int y1;
void setup()
{
size(1000, 700);
background(255);
//name of the usb port
String portname = Serial.list()[0];
//object port
port = new Serial(this, portname, 9600);
//Increase in 2 the thickness
strokeWeight(2);
//x axis
line(100, 650, 900, 650);
//y axis
line(100, 650, 100, 50);
//intervals x axis
for(int i = 0; i < 16;i++)
{
line(x, 640, x, 660);
x = x + 50;
}
//intervals y axis
for(int i = 0;i < 12; i++)
{
line(90, y, 110, y);
y = y - 50;
}
//values x axis
text("1", 147, 675);
for(int i = 0;i < 17;i++)
{
}
}
void draw()
{
//If port is available
if(port.available() > 0)
{
String string = port.readString();
val = float(string);
println(val);
}
}
`
Answers
i indented the code but the forum disorganize it
Edit your post, select your code and hit ctrl+o. Ensure there is an empty line above and below your code.
Kf
Same result
ok, i did it
Ok, what are seeing and what are you expecting to see (correctly) ?
Which line number?55?
i expect to see an "1" at x:147 y:675 .
Instead there is nothing.
It could be that the color is white
try fill(99);
Before the text() line 55
I modified your draw function only.
Kf
https://forum.Processing.org/two/discussion/20340/incorrect-data