I believe all Processing programs have two parts, being the setup and draw functions. The setup function runs first once and then the draw function loops endlessly until something commands the program to stop. Your setup function sets up the screen and the audio player, appears to start playing an mp3 file (which I assume operates in the background) and then sets up the serial port. The draw function loops endlessly making a blank screen. The stop function is never called. The Arduino will be filling up the serial port with data that the Processing program never knows about because the Processing program is missing a "serialEvent" function to receive the serial data and decide what to do with it. You need to add the serialEvent function with the right code in it to understand the number from the Arduino and do the right thing on the Processing side with that number for the rest of the Processing program, which you have yet to create, to do want you want it to do. You'll probably have a use for the stop function at some point in your project.
↧