|
6 | 6 | import adafruit_esp32spi.adafruit_esp32spi_wifimanager as wifimanager
|
7 | 7 | import adafruit_esp32spi.adafruit_esp32spi_server as server
|
8 | 8 |
|
| 9 | +import neopixel |
| 10 | + |
9 | 11 | # Get wifi details and more from a secrets.py file
|
10 | 12 | try:
|
11 | 13 | from secrets import secrets
|
|
21 | 23 | esp32_gpio0 = DigitalInOut(board.D12)
|
22 | 24 |
|
23 | 25 | """Use below for Most Boards"""
|
24 |
| -# status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards |
| 26 | +status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards |
25 | 27 | """Uncomment below for ItsyBitsy M4"""
|
26 |
| -import adafruit_dotstar as dotstar |
27 |
| -status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) |
| 28 | +# import adafruit_dotstar as dotstar |
| 29 | +# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=1) |
28 | 30 |
|
29 | 31 |
|
30 | 32 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
31 |
| -esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset, gpio0_pin=esp32_gpio0, debug=False) |
| 33 | +esp = adafruit_esp32spi.ESP_SPIcontrol( |
| 34 | + spi, esp32_cs, esp32_ready, esp32_reset, gpio0_pin=esp32_gpio0, debug=False) |
32 | 35 |
|
33 | 36 | ## Connect to wifi with secrets
|
34 | 37 | wifi = wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light, debug=True)
|
|
40 | 43 |
|
41 | 44 | def onLedHigh(headers, body, client):
|
42 | 45 | print("led on!")
|
| 46 | + print("headers: ", headers) |
| 47 | + print("body: ", body) |
43 | 48 | status_light.fill((0, 0, 100))
|
44 | 49 | respond(headers, body, client)
|
45 | 50 |
|
46 | 51 | def onLedLow(headers, body, client):
|
47 | 52 | print("led off!")
|
| 53 | + print("headers: ", headers) |
| 54 | + print("body: ", body) |
48 | 55 | status_light.fill(0)
|
49 | 56 | respond(headers, body, client)
|
50 | 57 |
|
51 | 58 | def respond(headers, body, client):
|
| 59 | + print("headers: ", headers) |
| 60 | + print("body: ", body) |
| 61 | + |
52 | 62 | client.write(b"HTTP/1.1 200 OK\r\n")
|
53 | 63 | client.write(b"Content-type:text/html\r\n")
|
54 | 64 | client.write(b"\r\n")
|
|
0 commit comments