Skip to content

Commit 7db6bd9

Browse files
authored
Update esp_atcontrol_aio_post.py
added support for challenger 2040 wifi
1 parent 2d7aab9 commit 7db6bd9

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

examples/esp_atcontrol_aio_post.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

4+
# Note, you must create a feed called "test" in your AdafruitIO account.
5+
# Your secrets file must contain your aio_username and aio_key
6+
47
import time
58
import board
69
import busio
@@ -21,21 +24,34 @@
2124
print("WiFi secrets are kept in secrets.py, please add them there!")
2225
raise
2326

27+
# Debug Level
28+
# Change the Debug Flag if you have issues with AT commands
29+
debugflag=False
2430

25-
# With a Particle Argon
26-
RX = board.ESP_TX
27-
TX = board.ESP_RX
28-
resetpin = DigitalInOut(board.ESP_WIFI_EN)
29-
rtspin = DigitalInOut(board.ESP_CTS)
30-
uart = busio.UART(TX, RX, timeout=0.1)
31-
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
32-
esp_boot.direction = Direction.OUTPUT
33-
esp_boot.value = True
34-
status_light = None
31+
if board.board_id == "challenger_rp2040_wifi":
32+
RX = board.ESP_RX
33+
TX = board.ESP_TX
34+
resetpin = DigitalInOut(board.WIFI_RESET)
35+
rtspin = False
36+
uart = busio.UART(TX, RX, baudrate=11520)
37+
esp_boot = DigitalInOut(board.WIFI_MODE)
38+
esp_boot.direction = Direction.OUTPUT
39+
esp_boot.value = True
40+
status_light = None
41+
else:
42+
RX = board.ESP_TX
43+
TX = board.ESP_RX
44+
resetpin = DigitalInOut(board.ESP_WIFI_EN)
45+
rtspin = DigitalInOut(board.ESP_CTS)
46+
uart = busio.UART(TX, RX, timeout=0.1)
47+
esp_boot = DigitalInOut(board.ESP_BOOT_MODE)
48+
esp_boot.direction = Direction.OUTPUT
49+
esp_boot.value = True
50+
status_light = None
3551

3652
print("ESP AT commands")
3753
esp = adafruit_espatcontrol.ESP_ATcontrol(
38-
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False
54+
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag
3955
)
4056
wifi = adafruit_espatcontrol_wifimanager.ESPAT_WiFiManager(esp, secrets, status_light)
4157

0 commit comments

Comments
 (0)