Skip to content

Commit 4110a44

Browse files
committed
Fixed line endings
1 parent a9fd632 commit 4110a44

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
import time
2-
import board
3-
import busio
4-
from digitalio import DigitalInOut
5-
6-
from adafruit_esp32spi import adafruit_esp32spi
7-
import adafruit_esp32spi.adafruit_esp32spi_requests as requests
8-
9-
print("ESP32 SPI WPA2 Enterprise test")
10-
11-
# For running on the PyPortal, use this block
1+
import time
2+
import board
3+
import busio
4+
from digitalio import DigitalInOut
5+
6+
from adafruit_esp32spi import adafruit_esp32spi
7+
import adafruit_esp32spi.adafruit_esp32spi_requests as requests
8+
9+
print("ESP32 SPI WPA2 Enterprise test")
10+
11+
# For running on the PyPortal, use this block
1212
esp32_cs = DigitalInOut(board.ESP_CS)
1313
esp32_ready = DigitalInOut(board.ESP_BUSY)
1414
esp32_reset = DigitalInOut(board.ESP_RESET)
15-
16-
# For a board that doesn't have the ESP pin definitions, use this block and
17-
# set the pins as needed. To connect your board to an ESP32 HUZZAH, here
18-
# are the pin-outs on the HUZZAH32:
19-
# https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32/firmware-files#esp32-only-spi-firmware-3-8
20-
#esp32_cs = DigitalInOut(board.D8)
21-
#esp32_ready = DigitalInOut(board.D5)
22-
#esp32_reset = DigitalInOut(board.D7)
23-
24-
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
25-
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
26-
27-
requests.set_interface(esp)
28-
29-
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
30-
print("ESP32 found and in idle mode")
31-
print("Firmware vers.", esp.firmware_version)
32-
print("MAC addr:", [hex(i) for i in esp.MAC_address])
33-
34-
# Set up the SSID you would like to connect to
35-
esp.wifi_set_network(b'YOUR_SSID_HERE')
36-
37-
# If your WPA2 Enterprise network requires an anonymous
38-
# identity to be set, you may set that here
39-
esp.wifi_set_entidentity(b'')
40-
41-
# Set the WPA2 Enterprise username you'd like to use
42-
esp.wifi_set_entusername(b'MY_USERNAME')
43-
44-
# Set the WPA2 Enterprise password you'd like to use
45-
esp.wifi_set_entpassword(b'MY_PASSWORD')
46-
47-
# Once the network settings have been configured,
48-
# we need to enable WPA2 Enterprise mode on the ESP32
49-
esp.wifi_set_entenable()
50-
51-
# Wait for the network to come up
52-
print("Connecting to AP...")
53-
while not esp.is_connected:
54-
print(".", end = "")
55-
time.sleep(2)
56-
57-
print("")
58-
print("Connected to", str(esp.ssid, 'utf-8'), "\tRSSI:", esp.rssi)
59-
print("My IP address is", esp.pretty_ip(esp.ip_address))
60-
print("IP lookup adafruit.com: %s" % esp.pretty_ip(esp.get_host_by_name("adafruit.com")))
61-
print("Ping google.com: %d ms" % esp.ping("google.com"))
62-
63-
print("Done!")
15+
16+
# For a board that doesn't have the ESP pin definitions, use this block and
17+
# set the pins as needed. To connect your board to an ESP32 HUZZAH, here
18+
# are the pin-outs on the HUZZAH32:
19+
# https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32/firmware-files#esp32-only-spi-firmware-3-8
20+
#esp32_cs = DigitalInOut(board.D8)
21+
#esp32_ready = DigitalInOut(board.D5)
22+
#esp32_reset = DigitalInOut(board.D7)
23+
24+
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
25+
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
26+
27+
requests.set_interface(esp)
28+
29+
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
30+
print("ESP32 found and in idle mode")
31+
print("Firmware vers.", esp.firmware_version)
32+
print("MAC addr:", [hex(i) for i in esp.MAC_address])
33+
34+
# Set up the SSID you would like to connect to
35+
esp.wifi_set_network(b'YOUR_SSID_HERE')
36+
37+
# If your WPA2 Enterprise network requires an anonymous
38+
# identity to be set, you may set that here
39+
esp.wifi_set_entidentity(b'')
40+
41+
# Set the WPA2 Enterprise username you'd like to use
42+
esp.wifi_set_entusername(b'MY_USERNAME')
43+
44+
# Set the WPA2 Enterprise password you'd like to use
45+
esp.wifi_set_entpassword(b'MY_PASSWORD')
46+
47+
# Once the network settings have been configured,
48+
# we need to enable WPA2 Enterprise mode on the ESP32
49+
esp.wifi_set_entenable()
50+
51+
# Wait for the network to come up
52+
print("Connecting to AP...")
53+
while not esp.is_connected:
54+
print(".", end = "")
55+
time.sleep(2)
56+
57+
print("")
58+
print("Connected to", str(esp.ssid, 'utf-8'), "\tRSSI:", esp.rssi)
59+
print("My IP address is", esp.pretty_ip(esp.ip_address))
60+
print("IP lookup adafruit.com: %s" % esp.pretty_ip(esp.get_host_by_name("adafruit.com")))
61+
print("Ping google.com: %d ms" % esp.ping("google.com"))
62+
63+
print("Done!")

0 commit comments

Comments
 (0)