General Note GCC
The latest version of Pi OS only supplies GCC 8.3 in a bare metal compiler configuration arm-none-eabi and this is the Kit you should select.
The alternative 10.2 targets Linux and cannot be used to compile Pico programs.
Windows 10 currently supplies 10.3 arm-none-eabi for bare metal targets.
General Note RDP
The latest version of Pi OS needs some tweeking to make Windows remote desktop work.
See the article on I Programmer - Remote Desktop To A Headless Pi Running Bullseye
General Note PIO
To avoid having to use GPIO lines in SPI mode the driver makes use of one of the PIOs. This means that you should avoid using the same PIO as the WiFi driver for general purpose I/O. Which PIO is used is set by
#define CYW43_SPI_PIO_PREFERRED_PIO 1
You can override this if you want to but it is simpler to use PIO 0 for your own PIO programs. The driver uses a single state machine and ten bytes of instruction memory. If you want to use PIO 1 you can use pio_claim_unused_sm to find a free state machine.
All of the examples in the PIO chapter use PIO 0.
General Note Windows Installer
As of SDK 1.5 there is an official installation script for Windows and it makes the job of getting started much simpler. You can find it at:
and it is easy to use and it works.
To find the exe file you first need to navigate to the latest releases:
Then download the appropriate installer from the Assets section.
And run the .exe file from the command prompt.
At the time of writing it automatically installs and configures the following:
Arm GNU Toolchain
Git for Windows
Visual Studio Code
The installation provides a specially configured version of VS Code – Pico-Visual Studio Code and a Pico configured PowerShell and Command Prompt. In fact the PowerShell is used to start VS Code with the correct environment parameters. It also installs Ninja as the make utility not the default Nmake.
You need to always ensure that you start VS Code using the Pico shortcut otherwise you will get an unconfigured VS Code that will not know how to compile your program.
Swap the Emitter Collector labels on the diagram at the top of the page. The Emitter is always the one with the arrow!
Page 84 Top line
We have already met the functions that sets a GPIO line to input or output:
We have already met the functions that set a GPIO line to input or output:
One of the most common input circuits is the switch or button. If you want another external button you can use any GPIO line and the circuit explained in the previous chapter. That is, the switch has to have either a pull-up or pull-down resistor either provided by you or a built-in one enabled using software.
One of the most common input circuits is the switch or button. If you want add a button you can use any GPIO line and the circuit explained in the previous chapter. That is, the switch has to have either a pull-up or pull-down resistor either provided by you or a built-in one enabled using software.
The program simply tests for the line to be pulled low by the switch being closed and then sets GP21 high. If you connect GP21 to an LED or a logic analyzer you will see the effect of the button being closed – the LED will light up while it is pressed. Notice GP22 goes low to indicate that the switch is pressed.
The program simply tests for the line, GP21, to be pulled low by the switch being closed and then sets GP22 high. If you connect GP22 to an LED or a logic analyzer you will see the effect of the button being closed – the LED will light up while it is pressed.
If you are only interested in transmitting data from the Pico you only need to connect Pin 1 and Pin10.
If you are only interested in transmitting data from the Pico you only need to connect Pin 1 and Pin 2.
The fist line of int presence(uint8_t pin)
The function is correct in the final listing.
Spotted by Larry Simoneau - many thanks.
Change the body function from: