Making Things Interactive

March 26, 2008

More State Machine Examples

Filed under: Class Notes,Course Materials — jet @ 2:16 pm

There are two examples in the PDF:

  1. using the switch/case statement to implement a state machine.  It’s not crucial that you understand this, but if it makes sense to you, it’s cleaner than using repeated if/else statements.  There are explanations in the comments, but also read the arduino docs.
  2. changing PulseLed so that it can read a button while making the LED grow brighter and darker.  This involves havnig PulseLed return a “boolean” value of “true” or “false” and changing the statemachine to use this value to change state.  See the comments for full details.

state machine examples #2

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: