Figure B-10.
Settings for COM3 connection
Note down the communications parameters: 9600 bits per sec-
ond, 8 data bits, no parity, 1 stop bit, no flow control.
Then open your terminal emulator. We’re using PuTTY for Windows.
Enter the communications parameters into the settings, making
sure you’re specifying a Serial connection rather than an SSH one,
and you should be connected to the Pico’s MicroPython REPL.
Appendix B 207
GSW_RASPI_4ED_FIN.indd 207GSW_RASPI_4ED_FIN.indd 207 10/28/21 10:55 AM10/28/21 10:55 AM
Figure B-11.
Entering settings in PuTTY
If you’re using Linux (on your Pi, for example), you don’t need any of
the communications parameters, as the Pico is really attached to a
virtual serial port. If you’re using minicom, just enter minicom-o-D/
dev/ttyACM0 and press Enter once the minicom window opens to
get the initial >>> REPL prompt. (Minicom can be installed with a sim-
ple sudo apt-get install minicom.)
Using MicroPython on the Pico
So now your computer is connected directly to the Pico’s REPL via
your terminal emulator program. You should see something like
this:
Figure B-12.
Minicom connection to the Pico onthe Pi
208 Appendix B
GSW_RASPI_4ED_FIN.indd 208GSW_RASPI_4ED_FIN.indd 208 10/28/21 10:55 AM10/28/21 10:55 AM
It looks almost exactly like the description of the REPL a few pages
ago, because it is. You can stick to tradition and type print ("Hello
World") as your first MicroPython program if you want to, but there
are more exciting things in store.
Blinking an LED on the Pico
from machine import Pin
led = Pin(25, Pin.OUT)
led.value(1)
What happened? One of the LEDs on the Pico just lit up! To shut
it off, type into the REPL:
led.value(0)
It’s generally accepted that the ability to control a microcontroller
pin in this way is the foundation of all physical computing. Now that
you’ve got that pin working, the world is yours!
Digression
Did you know that the Chrome browser keeps track of the
devices plugged into your computer? And did you know that
you can get Chrome to tell you which devices are plugged into
your computer? Just type: chrome://device-log/?refresh=30
into the address bar to see what Chrome knows about your
computer. Kind of cool, and kind of creepy.
Appendix B 209
GSW_RASPI_4ED_FIN.indd 209GSW_RASPI_4ED_FIN.indd 209 10/28/21 10:55 AM10/28/21 10:55 AM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset