O'Reilly logo
  • Alexander Jaworowski thinks this is interesting:

we pass a new I/O pin handler object to the LED whenever a button is pressed


Cover of Making Embedded Systems


Where do we decide which handler? We have a global variable for number of counts. We could use enum and the counter could be used as index:

enum led_color {red, green, blue};