This chapter comes with four different versions of code that can work with the circuit shown previously in Figure 12.1. You will find the code in the chapter12 folder organized by version:
- chapter12/version1_eventloop is an event-loop-based example.
- chapter12/version2_thread is a thread and callback-based example.
- chapter12/version3_pubsub is a publisher-subscriber-based example.
- chapter12/version4_asyncio is an Asynchronous IO (AsyncIO)-based example.
All versions are functionally equivalent; however, they differ in their code structure and design. We will discuss each version in greater detail after we test our circuit.
Here are the steps to follow to run each version (starting with version 1) and test the circuit:
- Change to the version1_eventloop folder.
- Briefly look over the main.py source file, and any additional Python files in the folder, to get a feel for what they contain and how the program is structured.
- Run...