Читать книгу Raspberry Pi For Dummies - McManus Sean, Evans Jonathan, Sean McManus - Страница 19

RASPBERRY PI PICO: A MICROCONTROLLER, NOT A COMPUTER

Оглавление

The Raspberry Pi Pico is a radical new departure for the Raspberry Pi Foundation. Whereas previous devices were general-purpose computers, Raspberry Pi Pico is a microcontroller. A microcontroller is usually built into a device that does one job, such as a heating system or a microwave oven.

You can use the Raspberry Pi Pico for your electronics projects. You program it by connecting it to a computer. It’s similar to the Arduino, which you might have heard of, but the Pico uses the Raspberry Pi Foundation’s own custom chip.

The big advantage of a microcontroller is that there is no operating system to get in the way of things, so you can get precise control over the signals coming from its pins. This is important for things like audio generation and motor/servo control.

The Raspberry Pi Pico can be programmed using either MicroPython or C, which are both programming languages. (A programming language is a way of giving instructions to a computer or computing device – Part 4 introduces you to some programming languages). MicroPython is a version of Python optimized for running on microcontrollers. There are a few differences in some instructions, but MicroPython mostly looks the same as Python. You can program a Pico using Thonny, a Python programming tool available in Raspberry Pi OS. You get the option of saving your code into the Pico’s memory or your computer. Any code saved into a file called main.py will run automatically when power is applied to the Pico, independently of whether you have a computer attached.

Programming a Pico in C, however, is not for the fainthearted. It requires a long process to prepare the C code for compiling or the use of a complex piece of software. We expect it to get easier, but at the moment we would recommend MicroPython instead.

The Raspberry Pi Pico is extremely cheap: It costs just $4, and it doesn't need an additional microSD card for storage.

You can find more information on the Raspberry Pi Pico in Chapter 17, but our focus in this book is on the Raspberry Pi computers and not the microcontroller. When we say “the Raspberry Pi,” we’re referring to the computers.

Raspberry Pi For Dummies

Подняться наверх