|
8 | 8 |
|
9 | 9 | print("ESP32 SPI webclient test") |
10 | 10 |
|
11 | | -# Get wifi details and more from a settings.py file |
| 11 | +# Get wifi details and more from a secrets.py file |
12 | 12 | try: |
13 | | - from esp32spi_settings import settings |
| 13 | + from esp32spi_secrets import secrets |
14 | 14 | except ImportError: |
15 | | - print("WiFi settings are kept in esp32spi_settings.py, please add them there!") |
| 15 | + print("WiFi secrets are kept in secrets.py, please add them there!") |
16 | 16 | raise |
17 | 17 |
|
18 | 18 | esp32_cs = DigitalInOut(board.D9) |
19 | 19 | esp32_ready = DigitalInOut(board.D10) |
20 | 20 | esp32_reset = DigitalInOut(board.D5) |
21 | 21 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) |
22 | 22 | esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) |
23 | | -wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, settings, board.NEOPIXEL) |
| 23 | +wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, board.NEOPIXEL) |
24 | 24 |
|
25 | 25 | counter = 0 |
26 | 26 | while True: |
|
30 | 30 | feed = 'test' |
31 | 31 | payload = {'value':data} |
32 | 32 | response = wifi.post( |
33 | | - "https://io.adafruit.com/api/v2/"+settings['aio_username']+"/feeds/"+feed+"/data", |
34 | | - json=payload,headers={bytes("X-AIO-KEY","utf-8"):bytes(settings['aio_key'],"utf-8")}) |
| 33 | + "https://io.adafruit.com/api/v2/"+secrets['aio_username']+"/feeds/"+feed+"/data", |
| 34 | + json=payload,headers={bytes("X-AIO-KEY","utf-8"):bytes(secrets['aio_key'],"utf-8")}) |
35 | 35 | print(response.json()) |
36 | 36 | response.close() |
37 | 37 | counter = counter + 1 |
|
0 commit comments