Hello,
I am trying to send color data from Processing to Arduino.
Here is my Arduino sketch:
GetColor
void setup() {
Serial.begin(115200);
}
void loop() {
if(Serial.available()){
int val = Serial.read();
Serial.println(val);
}
}
Here is the Processing sketch:
import processing.serial.*;
Serial myPort;
void setup()
{
background( 0 );
println(Serial.list());
myPort = new Serial(this, Serial.list()[7], 115200);
}
void draw()
{
if(myPort.available > 0){
color mycolor= color(225,0,0);
myPort.write(mycolor);
}
}
I know it is a matter of data types but i do not know which is sending or getting which. I think from Arduino side, i have to get a string like "255, 0 ,0" and string format and put it in an array value like colorValues[255, 0, 0];
Something similar but in reverse fashion in this example.
Anyone have any idea how to achieve this?
Thanks