Connect Raspberry Pi Pico W to Google Firebase using MicroPython

The best library to connect your little Raspberry Pi Pico W to Google Firebase using MircoPython is found here.

  1. Connect Raspberry Pi Pico W to Wireless

Make a new file called secrets.py and paste this code:

secrets = {
'ssid': 'Wifi-name', #Our wifi SSID
'pw': 'password', #Our wifi PASSWORD
'database': '' #Our Google Firebase URL adress database
}

In main.py paste this code:

 

import os as MOD_OS
import rp2
import network

# Set country to avoid possible errors
rp2.country(‘RO’)

wlan = network.WLAN(network.STA_IF)
wlan.active(True)

ssid = secrets[‘ssid’]
pw = secrets[‘pw’]
database = secrets[‘database’]

wlan.connect(ssid, pw)