Follow these steps to learn how to create a joke-telling machine:
- Run the following lines of code in the REPL:
>>> from displayio import OnDiskBitmap, ColorConverter, TileGrid, Group >>> import board >>> import random >>> import time >>> import touchio >>> import os
- We have now imported all the necessary modules. The following block of code will create a TouchIn object:
>>> touch = touchio.TouchIn(board.TOUCH1) >>>
- In the following block of code, we will check the status of the touchpad:
>>> touch.value False
- Touch the pad while executing the following block of code:
>>> touch.value True
- The following block of code will define the wait_for_touch function, which will keep looping until a touch event is detected: ...