We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The full message I am getting is: Error, disabling serialEvent() for /dev/cu.usbmodem2574541 null
The sketch will get the data one time than it hangs on this message.
Here is my code; I am getting the data from an arduino teensy 3.5 Please help.
Thanks
import processing.serial.*; Serial port; int BaseEncGlobal; int ElbowEncGlobal; int ShoEncGlobal; int VertRotEnc; int HorRotEnc; int GripEncGlobal;
double X_axis; double Y_axis; double Z_axis; double GripAngle;
String data; boolean newData = false;
PFont font;
void setup() { size(1280,800); //port = new Serial(this, "/dev/cu.usbserial-A50285BI", 115200); port = new Serial(this, "/dev/cu.usbmodem2574541", 115200); port.bufferUntil('\n'); font = loadFont("AgencyFB-Bold-200.vlw"); textFont(font, 40); }
void draw()
{ if (newData == true) {
int spaceDown = 55; background(0,0,0); fill(46, 209, 2); text(BaseEncGlobal, 70, spaceDown); fill(0, 102, 153); text(ShoEncGlobal, 70, spaceDown2); fill(0, 102, 153); text(ElbowEncGlobal, 70, spaceDown3); fill(0, 102, 153); text(VertRotEnc, 70, spaceDown4); fill(0, 102, 153); text(HorRotEnc, 70, spaceDown5); fill(0, 102, 153); text( GripEncGlobal, 70, spaceDown*6);
text(Double.toString(X_axis/10), 270, spaceDown ); newData =false; }
}
void serialEvent (Serial port) {
data = port.readStringUntil('\n'); if (data != null) { data = trim(data);
int[] nums = int(split(data, ',')); BaseEncGlobal = nums [1]; ShoEncGlobal = nums [2]; ElbowEncGlobal = nums [3]; VertRotEnc = nums [4]; HorRotEnc = nums [5]; GripEncGlobal = nums [6]; X_axis = nums [7]; Y_axis = nums [8]; Z_axis = nums [9]; GripAngle = nums [10]; //println(Double.toString(X_axis/10));
println(data);
newData = true; }
}
/*
void serialEvent (Serial port) { data = port.readStringUntil('.'); data = data.substring(0, data.length() - 1);
// look for the comma between Celcius and Farenheit index = data.indexOf(","); // fetch the C Temp temp_c = data.substring(0, index); // fetch the F Temp //temp_f = data.substring(index+1, index); temp_f = data.substring(1, data.length());
ElbowEncGlobal = getValue(data, ',', 2);
} */
Answers
Problem solved I used the AP_sync library.
Much nicer https://ap-sync.github.io/
There is a New forum
Please share there as well