Button¶
Overview¶
The Button sample demonstrates the use of GPIO input using the digitalio
module. It prints a message to the console each time the state of the button changes.
Requirements¶
Before you start, check that you have the required hardware and software:
- 1x iMX RT1011 Nano Kit running the CircuitPython firmware
- 1x USB-C Cable
- Mu Editor
- A computer running macOS, Linux, or Windows 7 or newer
Running the code¶
To run the code, complete the following steps:
- Connect iMX RT1011 Nano Kit to your computer using the USB-C Cable.
- Start Mu Editor, click Load to open
code.py
in the CIRCUITPY drive. -
Copy and paste the following code into
code.py
and click Save: -
Your code will run as soon as the file is done saving. Click Serial on Mu Editor's Top Menu to open a serial console. Observe the output of the console and press the USR/BT button. You should see the output, similar to what is shown in the following: