Micro Python - Connecting to Wifi

Raspberry Pi Pico
Below is the code for connecting to WIFI with a Raspberry Pi Pico W (and then blink an LED).


Tested on a Raspberry Pi Pico W.







Micro Python Code:

import network

import machine

import time


# Set SSID and password for your WiFi network

ssid = "YOUR SSID"

password = "YOUR PASSWORD"


# Create WLAN object

wlan = network.WLAN(network.STA_IF)


# Enable wireless

wlan.active(True)


# Connect to WiFi network

wlan.connect(ssid, password)


# Check connection status

while not wlan.isconnected():

    pass


# Print the connection status

print("Connected to WiFi")


#start your code here

pin = machine.Pin("LED", machine.Pin.OUT)


# blink LED

while True:

  pin.on()

  time.sleep(0.5)

  pin.off()

  time.sleep(0.5)


Popular posts from this blog

Review - E-Yooso Z-88 Keyboard

Replacing Viking GB455 Mulcher Blades