Serial communication between Arduino and Processing and resetting the sketch problem

Hi @jinjin, I can’t give you the complete answer for your project, but I think you need help to understand a few things, and then you’ll put the pieces together to get it working.

(It would be easier for people to help you if you could edit your post, and select the whole code, and select </> .)

That code is all Processing? You haven’t shown your Arduino code because you are using Firmata?
(I don’t know how to use Firmata with the heartbeat sensor.)

At the moment you have one big project, but I think you should think of it as a few smaller projects, and try other sketches and examples just to see how things work.

  • What kind of Arduino do you have? I’m thinking what options there are for seeing what’s happening. Do you have any LCD or OLED displays for it?

  • Arduino and heartbeat - what is the definition of what comes from that? Is it working?

  • ‘void mousePressed()’ - find that in the help, copy the example and try it.

  • I created an example of Arduino and Processing serial comms. That should be very easy to run on your hardware. One way forward would be for you to substitute your heartbeat value for one of those values, then change the display to what you want to see.

If you can answer the questions and try a few things we can probably get it working.

Richard.