I have written a code in arduino which sends string of data Arduino code lines:
int analog_value = analogRead(A0);//reading forward voltage
int analog_valuer = analogRead(A1);//reading reverse voltage
fwd_voltage = (analog_value * 5.0) / 1024.0;
rev_voltage = (analog_valuer * 5.0) / 1024.0;
fpower = ((fwd_voltage)*(fwd_voltage)*10000);
rpower = ((rev_voltage)*(rev_voltage)*10000);
String fp = String(fpower);
String rp =String(rpower);
Serial.println("REV");
Serial.println(rp);
Serial.println("W \n");
Serial.println("FWD");
Serial.println(fp);
Serial.println("W");
I want to print the data in processing console like this
REV [some value] W
FWD [some value] W
This is my processing code
void serialEvent(Serial myPort) {
while(port.available()>0){
val = port.readString();
}
if (val!=null)
{
println(val);
}
}