Can anyone help me with my processing code? I got a zero output in the text message ,and there are also some error:
Exception in thread "Thread-3" java.lang.NullPointerException
at processing.serial.Serial.serialEvent(Serial.java:221)
at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
at gnu.io.RXTXPort.eventLoop(Native Method)
at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
Here is my processing code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int sensorPin = 7;
int sensorValue;
void setup() {
size(470, 280);
arduino = new Arduino(this, Arduino.list()[0], 9600);
arduino.pinMode(sensorPin, Arduino.INPUT);
}
void draw() {
sensorValue = arduino.digitalRead(sensorPin);
println(sensorValue);
}