Making Things Talk Ch2 Question (solved)

Hello Arduino Community,

I'm just getting started on Arduino and working through some examples in Tom Igoe's "Making Things Talk" book.

In Ch 2, the book guides you through construction of a pong game using flex sensors as controls. The code for this example is available online at: http://www.makingthingstalk.com/chapter2/54/

We see that there are methods draw() and animateBall(). Obviously, these are methods that aid in rendering the pong game animation. My question is this: Aren't these methods instructions for my computer to run to draw the pong game? Why are these methods in a sketch that gets uploaded onto the Arduino? What would Arduino even do with the draw() method?

The main thing I don't understand is the where the division is between my computer and my Arduino. Obviously, both needed in this project. But there is only one sketch file. How are the instructions divided? How can I tell which lines of code are processed by Arduino, and which are processed by my computer?

Thanks for your time!

What you linked to is the Processing sketch, not the Arduino sketch. http://processing.org/
So that is code that runs on your PC, not on the Arduino (and in fact would not compile for the Arduino).

Ooooh I get it. So let's see if I got this right...I had one Arduino sketch that I uploaded on the Arduino, and that just interpreted the values from the flex sensors and sent certain values over serial com. And then the Processing sketch (the one that I linked to) listens to that particular port for all these values and converts them into some graphical representation (the pong game).

So...follow up question: In actuality, would it be correct to say that I do not necessarily need Processing to interpret the serial data coming in? I could write any program in Python or Java or any other language that listens to data coming from that serial port, right?

Btw, thanks jraskell for your help and quick reply!

I could write any program in Python or Java or any other language that listens to data coming from that serial port, right?

Yes. Any language that you like, that provides a mechanism for communicating with the serial port, can be used.

Thank you, Paul!

Wow..this Arduino community is so responsive and helpful!