|
21 | 21 | print("WiFi secrets are kept in secrets.py, please add them there!")
|
22 | 22 | raise
|
23 | 23 |
|
24 |
| - |
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 |
35 |
| - |
| 24 | +# Debug Level |
| 25 | +# Change the Debug Flag if you have issues with AT commands |
| 26 | +debugflag = False |
| 27 | + |
| 28 | +# How Long to sleep between polling |
| 29 | +sleep_duration = 5 |
| 30 | + |
| 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, receiver_buffer_size=2048) |
| 37 | + esp_boot = DigitalInOut(board.WIFI_MODE) |
| 38 | + esp_boot.direction = Direction.OUTPUT |
| 39 | + esp_boot.value = True |
| 40 | + status_light = None |
| 41 | + |
| 42 | +else: |
| 43 | + RX = board.ESP_TX |
| 44 | + TX = board.ESP_RX |
| 45 | + resetpin = DigitalInOut(board.ESP_WIFI_EN) |
| 46 | + rtspin = DigitalInOut(board.ESP_CTS) |
| 47 | + uart = busio.UART(TX, RX, timeout=0.1) |
| 48 | + esp_boot = DigitalInOut(board.ESP_BOOT_MODE) |
| 49 | + esp_boot.direction = Direction.OUTPUT |
| 50 | + esp_boot.value = True |
| 51 | + status_light = None |
36 | 52 |
|
37 | 53 | print("ESP AT commands")
|
38 | 54 | esp = adafruit_espatcontrol.ESP_ATcontrol(
|
39 |
| - uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False |
| 55 | + uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag |
40 | 56 | )
|
41 | 57 | wifi = adafruit_espatcontrol_wifimanager.ESPAT_WiFiManager(esp, secrets, status_light)
|
42 | 58 |
|
|
78 | 94 |
|
79 | 95 | while True:
|
80 | 96 | print(time.localtime())
|
81 |
| - time.sleep(1) |
| 97 | + print("Sleeping for: {0} Seconds".format(sleep_duration)) |
| 98 | + time.sleep(sleep_duration) |
| 99 | + |
0 commit comments