Serial Event null pointer exception

You’re invoking method remove() inside serialEvent() callback, which is run by the Serial’s Thread btW! :thread:

That is a big no, no! You’re better off just using readString() inside serialEvent() to grab the received String. :prayer_beads:

However, parse that as JSONObject within draw() instead. :framed_picture:

You can use the noLoop()/redraw() approach for a much easier event management: :bulb:

1 Like