Adafruit Magtag #
If your magtag already has the U2F bootloader on it, you can just double-click the reset button to enter bootmode, then drag the .uf2 file with the latest release of CircuitPython onto the magtag bootloader drive that appears. Otherwise you will need to use the ESP32 bin tool to install it.
The magtag has peripherals and here is the printout.
Init the MagTag object:
from adafruit_magtag.magtag import MagTag
magtag = MagTag()
The MagTag has a buzzer. Play tones with:
magtag.peripherals.play_tone(<frequency>,<seconds>)
Check the battery level by looking at the magtag.peripherals.battery property.
print("battery is", magtag.peripherals.battery)
Deep Sleep
The MagTag can enter a super deep sleep for a certain number of seconds using the exit_and_deep_sleep function. When the time is up the MagTag will reboot and run the contents of code.py again.
magtag.exit_and_deep_sleep(15*60) # 15 minutes
To do a lighter sleep and wake up rather than restarting use the enter_light_sleep function.
magtag.enter_light_sleep(60) # 60 seconds