This paper describes how to apply the event-driven programming paradigm with modern state machines to develop software for Arduino. Specifically, you will learn how to build responsive, robust, and power-efficient Arduino programs with the open source QP/C++ state machine framework, which is like a modern real-time operating system (RTOS) specifically designed for executing event-driven state machines. You will also see how to take Arduino programming to the next level by using the the free QM modeling tool to generate Arduino code automatically from state diagrams.