Hello,
Are you able to get this to work?
Arduino Code
float angle;
int count;
void setup()
{
Serial.begin(9600);
delay(1000);
}
void loop()
{
float x = sin(angle);
float y = cos(angle);
Serial.print(count);
Serial.print(',');
Serial.print(x);
Serial.print(',');
Serial.print(y);
Serial.print('\n'); //same as Serial.println()
delay(100);
angle += TWO_PI/100;
count++;
}
Processing Code
import processing.serial.*;
Serial myPort; // The serial port
String inString; // Input string from serial port
int lf = 10; // ASCII linefeed
void setup()
{
size(400,200);
textSize(18);
// List all the available serial ports:
printArray(Serial.list());
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[2], 9600);
myPort.bufferUntil(lf);
delay(1000);
}
void draw()
{
background(0);
text("received: " + inString, 10,50);
}
void serialEvent(Serial p)
{
inString = p.readString();
}
Processing code is modified version of this:
https://processing.org/reference/libraries/serial/serialEvent_.html
’
’