
Connect to WiFi
OK now you have your secrets setup - you can connect to the Internet. Lets use the
ESP32SPI and the Requests libraries -
you'll need to visit the CircuitPython bundle
:
adafruit_bus_device
adafruit_esp32spi
adafruit_requests
neopixel
Into your
lib
folder. Once that's done, load up the following example using Mu or
your favorite editor:
# SPDX-FileCopyrightText: 2019 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import
board
import
busio
from
digitalio
import
DigitalInOut
import
adafruit_requests
as
requests
import
adafruit_esp32spi.adafruit_esp32spi_socket
as
socket
from
adafruit_esp32spi
import
adafruit_esp32spi
# Get wifi details and more from a secrets.py file
try
:
from
secrets
import
secrets
except
ImportError
:
(
"WiFi secrets are kept in secrets.py, please add them there!"
)
raise
(
"ESP32 SPI webclient test"
)
TEXT_URL
=
"http://wifitest.adafruit.com/testwifi/index.html"
JSON_URL
=
"http://api.coindesk.com/v1/bpi/currentprice/USD.json"
# If you are using a board with pre-defined ESP32 Pins:
esp32_cs
=
DigitalInOut(board.ESP_CS)
esp32_ready
=
DigitalInOut(board.ESP_BUSY)
esp32_reset
=
DigitalInOut(board.ESP_RESET)
# If you have an AirLift Shield:
# esp32_cs = DigitalInOut(board.D10)
# esp32_ready = DigitalInOut(board.D7)
# esp32_reset = DigitalInOut(board.D5)
# If you have an AirLift Featherwing or ItsyBitsy Airlift:
# esp32_cs = DigitalInOut(board.D13)
# esp32_ready = DigitalInOut(board.D11)
# esp32_reset = DigitalInOut(board.D12)
# If you have an externally connected ESP32:
# NOTE: You may need to change the pins to reflect your wiring
# esp32_cs = DigitalInOut(board.D9)
# esp32_ready = DigitalInOut(board.D10)
# esp32_reset = DigitalInOut(board.D5)
•
•
•
•
©Adafruit Industries
Page 16 of 54
Содержание Airlift Bitsy Add-On
Страница 4: ...Adafruit Industries Page 4 of 54...
Страница 7: ...Pinouts Adafruit Industries Page 7 of 54...
Страница 42: ...Adafruit Industries Page 42 of 54...
Страница 54: ...Fab Print Adafruit Industries Page 54 of 54...