Skip to content

Instantly share code, notes, and snippets.

@fearthecowboy
Last active December 9, 2018 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fearthecowboy/133fa865edd123446f196e8f155f3afc to your computer and use it in GitHub Desktop.
Save fearthecowboy/133fa865edd123446f196e8f155f3afc to your computer and use it in GitHub Desktop.
State-machine Arduino example
// include references to the devices that we'd like to use
#include "blinker.h" // an automated blinker
#include "switch.h" // a device that supports events for a switch (ie, closed, open)
#include "freeMemory.h" // an automated poller that reports teh free memory back to the serial console.
// Handy for debugging and seeing how much memory is getting sucked up.
// First, declare the states we want in our state machine:
States( starting, processing, cleanup ); // these can be anything you'd like.
// here are the devices that we're going to use.
Switch* switch1;
FreeMemoryReport* fm;
Blinker* bc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment