Help with code in the book Make: Getting Started with Arduino

Hello @JTR,

Welcome to the forum.

We all have to start somewhere!

This is a good starting point:
Welcome to the Processing Foundation Discourse << See Guidelines Asking Questions.

It is important to isolate the issue!
Scale it down to an MCVE (see guidelines for this) and this will help isolate it.

That is a common error… and not always so simple to find.

Reference:

I did not get errors in this code block (similar to yours with variables initialized):

Look outside of the code you provided for the source of the error.

:)