top of page

Raspberry Pi PICO | Getting Started with Thonny





Steps:

Step 1: Download and Install Thonny IDE from given link: https://thonny.org/



Step 3: Open Thonny IDE -> Tools -> manage Plug-Ins...


Step 4: Select Install from Local File


Step 5: Locate the downloaded Raspberry Pi Pico Github file and click on Open


Step 6: Go to Run -> Select Interpreter


Step 7: Select Micro Python (Raspberry Pi Pico) from Drop Down list and click OK




LED Blink Code:-

from machine import Pin
from time import sleep

led = Pin(25, Pin.OUT)

while True:
 led.toggle()
 sleep(0.2)

Step 8: Connect the Raspberry pi Pico to your Computer via USB Cable

You will get a popup to install MicroPython firmware for Raspberry Pi Pico

Just click on Install


Step 9: Click on Run Button to run the code on your Pico Board


Step 10: Click on Save to Save the code in Raspberry Pi Pico board

NOTE:- To run the code when you Power ON the Pico board all the time then save the code with name "main.py"



Project: ON OFF Relay with Push Button


Materials:-

Raspberry Pi Pico

Relay Module

Push Button

Jumpers

BreadBoard


Circuit:-


Code:-


from machine import Pin
from time import sleep

Relay = Pin(2,Pin.OUT)
Button = Pin(14,Pin.IN,Pin.PULL_UP)
state = 0

while True:
 input=Button.value()
 if(input == False):
 if(state == 1):
 Relay.high()
 state = 0
 sleep(0.5)
 elif(state == 0):
 Relay.low()
 state = 1
 sleep(0.5)


bottom of page