We now have a collection of robot behaviors, and we will be growing a few more of them, but beside the behaviors, we are going to create a simple menu system to select them. A convenient and phone friendly way to do this is to serve it to a browser, so we will also take that approach with our robot. Using HTTP and HTML also means that we could later let other systems make requests to our robot too. HTTP sends requests in a URL—first, the http:// protocol identifier, a server hostname, myrobot.local, a path, /mode/foo, and it may have additional parameters after that. We will be using the path of the URL to determine what our robot will do.
As we have done with other systems, we will create a few logical sections and blocks to handle different aspects of this:
- We will have code to manage the robot's modes, and...