NullPointerException hhhmmmmm
in
Programming Questions
•
2 years ago
Hi ...
I have my arduino uno that transmit ( Serial.println) every 100ms. The i have my processing program where i want to
readout the serial value in a line lenght. When i add the convesion from string to float (line) in the program i get a
NullPointerException. The serial communication when works fine if i just text("" + inString,10,50) but what
i add float a = float(inString); i got this NullPointer.......thing... why????
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); myPort = new Serial(this, Serial.list()[0], 9600); myPort.bufferUntil(lf); } void draw() { background(0); text("received: " + inString, 10,50); Works fine with this alone
//float a = float(inString); make the NullPointerExeception WHY??????
} void serialEvent(Serial p) { inString = p.readString(); }
Regards Fuzz
1