SCHOOL OF MAKING
calibration=((7000,59000),(8700,55000)),
size=(320,240))
The WiFi object is an adafruit_esp32_wifimanager
object that’s created with the following:
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
spi = busio.SPI(board.SCK, board.MOSI, board.
MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi,
esp32_cs, esp32_ready, esp32_reset)
status_light = neopixel.NeoPixel(board.NEOPIXEL,
1, brightness=0.2)
wifi = adafruit_esp32spi_wifimanager.ESPSPI_
WiFiManager(esp, secrets, status_light)
Finally, secrets is a dictionary containing things
that you don’t want to share publicly. In this case,
it needs to include your WiFi SSID, WiFi password,
and IFTTT key (more on this later). You’ll need a file
on your CircuitPython device called secrets.py that
contains the data structure in the following form:
secrets = {
‘ssid’ : ‘XXX’,
‘password’ : ‘XXX’,
‘ifttt_key’ : ‘XXX’
}
You can bring this into your main code.py program
with the following code:
try:
from secrets import secrets
except ImportError:
print(“WiFi secrets are kept in secrets.py,
please add them there!”)
raise
You can see how this all comes together as
this is the example on the IFTTT library here:
hsmag.cc/XzdCAs.
You’ll also need to include the MPY file for the
IFTTT module. You can download this from
hsmag.cc/lFqTxx. Make sure you get the version
that matches the version of CircuitPython you have.
Unzip the file and copy the MPY file to the libs
directory on your board.
Send data with If This Then That
You can have as many different event types
as you like associated with your account, each
triggering a different applet
”
”