How it works...
The main function creates a TouchIn object that's connected to the first touchpad connector on the board. The list of question images is retrieved by calling the get_questions() function and saving the returned list in the questions variable.
An infinite event loop is then started, which first selects a random question and calculates the associated response image for that question. The question image is then displayed on the screen by calling the show_image function. The wait_for_touch function is then called, which loops and checks for a touch event every 100 milliseconds.
Once a touch event is detected, the function is returned, and then the show_image function is called to show the response image. The wait_for_touch function ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access