上QQ阅读APP看书,第一时间看更新
How to do it...
Let's have a look at how to connect the REPL and run the code:
- Open the computer's Terminal application.
- List device names before plugging in device by running ls /dev/ttyACM* on Linux or ls /dev/tty.* on macOS.
- Connect the board to your computer with a USB cable.
- List the device names again with the same command to discover the device name of the board.
- If the device name is /dev/ttyACM0, then the screen command would be screen /dev/ttyACM0 115200.
- Enter the command in the Terminal and start the Screen application.
- If Screen is able to connect successfully, the Python REPL should appear on the Terminal with output similar to the following text:
Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit CircuitPlayground Express with samd21g18
>>>
- If the prompt doesn't appear, you can try pressing Ctrl + C and then press Enter, which will stop the currently running Python script and run the REPL with the following message:
Press any key to enter the REPL. Use CTRL-D to reload.
- Once the REPL prompt appears, we will have to test if the prompt is working by evaluating the 1+1 expression. It should produce the following output:
>>> 1+1
2