|
1 | 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
2 | 2 | # SPDX-License-Identifier: MIT
|
3 | 3 |
|
| 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 | + |
4 | 7 | import time
|
5 | 8 | import board
|
6 | 9 | import busio
|
|
21 | 24 | print("WiFi secrets are kept in secrets.py, please add them there!")
|
22 | 25 | raise
|
23 | 26 |
|
| 27 | +# Debug Level |
| 28 | +# Change the Debug Flag if you have issues with AT commands |
| 29 | +debugflag=False |
24 | 30 |
|
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 |
35 | 51 |
|
36 | 52 | print("ESP AT commands")
|
37 | 53 | 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 |
39 | 55 | )
|
40 | 56 | wifi = adafruit_espatcontrol_wifimanager.ESPAT_WiFiManager(esp, secrets, status_light)
|
41 | 57 |
|
|
0 commit comments