This section follows the tutorials that are defined on the Raspberry Pi page with some photos of the circuits as they look in reality.
Turning the LED on and off
Type the following into the Shell at the bottom of the screen. Type each line in turn then press return.
from picozero import pico_led
pico_led.on()
When it is typed in it will appear like this….

The LED should illuminate on the Pico board.

Then to turn it off again
from picozero import pico_led
pico_led.off()
The LED will go off, finally it can also be made to blink.
from picozero import pico_led
pico_led.blink()
and the LED will flash.
Using inputs and outputs
You might find the following resources useful for this project.
Connect the circuit as shown with the resistor connected to GP15 on the Pico via a 50-330 ohm resistor. The resistor is required to limit the current to the LED and prevent damaging the LED.

The longest leg must be connected to pin GP15 and the shortest leg to the negative rail.

Now, enter the following into the editor, after firstly clicking new.

Paste the following into the editor then click the green “go” button.
from picozero import pico_led
pico_led.blink()
The LED should now start blinking
If it doesn’t work then check that everything is connected correctly.
Controlling the LED with a Switch
Next, connect the button as show. It is worth noting that the connections to buttons and switches can change. Depending upon the one you have it might be different to the one shown on the Raspberry Pi website.

When I connected the circuit the LED was constantly on, so I had to wire it like this because the connections to the button was slightly different.

Type the following into the Shell and confirm that pressing the button turns the LED on and off.
from picozero import LED, Button
led = LED(15)
button = Button(14)
button.when_pressed = led.toggle
Pulsing LED
The LED can cycle from on to off following a button press using the following code:
from picozero import LED, Button
led = LED(15)
button = Button(14)
button.when_pressed = led.pulse
When the button is pressed the LED will start to cycle through brightness levels.
Changing the Brightness of the LED
Changing the brightness of the LED can be achieved by setting the brightness level. The following code cycles indefinitely setting the brightness level every second.
from picozero import LED
from time import sleep
led = LED(15)
while True:
led.brightness = 0.1 # very dim
sleep(1)
led.brightness = 0.5 # half brightness
sleep(1)
led.brightness = 1 # full brightness
sleep(1)
Controlling the LED using an analogue input
You might find the following resources useful for this project.
Connect the circuit as shown below:

Which should look like this:

Type the following in:
led = LED(15)
pot = Pot(26)
while True:
led.value = pot.value
Rotate the shaft of the potentiometer and the brightness of the LED should change.








