Skip to content

Commit

Permalink
tweak RM2 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
helgibbons authored and Gadgetoid committed Nov 21, 2024
1 parent 40e50c5 commit f1e82b1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@

# Specify the pins that that wireless module is connected to
# The pins below are for a Pimoroni Pico Plus 2 with a RM2 breakout connected via SP/CE
network.wlan_set_pins(32, 35, 34, 33) # Power, Data IO, Clock, CS
wlan = network.WLAN(network.STA_IF, pin_on=32, pin_out=35, pin_in=35, pin_wake=35, pin_clock=34, pin_cs=33)

# connect to wifi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(WIFI_SSID, WIFI_PASSWORD)
while wlan.isconnected() is False:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Get a cat fact from t'internet!
You will need to add your wireless SSID and password to secrets.py (and save this file to your Plasma)
"""

import network
import requests
from secrets import WIFI_SSID, WIFI_PASSWORD
from time import sleep

# Specify the pins that that wireless module is connected to
# The pins below are for a Plasma 2350 with a RM2 breakout connected via SP/CE
wlan = network.WLAN(network.STA_IF, pin_on=8, pin_out=11, pin_in=11, pin_wake=11, pin_clock=10, pin_cs=9)

# connect to wifi
wlan.active(True)
wlan.connect(WIFI_SSID, WIFI_PASSWORD)
while wlan.isconnected() is False:
print('Waiting for connection...')
sleep(1)

request = requests.get('http://catfact.ninja/fact').json()
fact = request['fact']
print('Cat fact!')
print(fact)
2 changes: 2 additions & 0 deletions micropython/examples/plasma_2350/breakouts/secrets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WIFI_SSID = 'ssid_goes_here'
WIFI_PASSWORD = 'password_goes_here'

0 comments on commit f1e82b1

Please sign in to comment.