Your HalloWing M0 should already come with CircuitPython but maybe there's a new version, or you overwrote your board with Arduino code! In that case, see the below for how to reinstall or update CircuitPython. Otherwise you can skip this and proceed with the build.
Install the following Adafruit libraries for Circuit Python by downloading the latest bundle. Unzip the file and locate the needed libraries. Drop the libraries into a folder named "lib" on the CIRCUITPY drive.
Required CircuitPython Libraries:
Before continuing make sure your board's lib folder or root filesystem has the adafruit_bus_device, adafruit_debouncer.mpy and adafruit_gps.mpy files are copied over.
The screen on the HalloWing will display a welcome message and proceed to acquire GPS satellites. Once it has acquired a fix, an audible "chirp" will sound letting you know it's ready. Depending on the location, a colored circle will appear on the display. A red circle means the locations are far way, yellow is close and green is nearby. Once a location is targeted, an image of the establishment will be displayed, followed by an audible name of the location and detailed description. Pressing the button will replay the name and detail audio if at a current location.
Copy and paste the code below into a new text document (we recommend using Mu as your editor, which is designed for CircuitPython.). Save the file and name it as main.py
Once the files has been uploaded to the drive, the board will automatically reboot and run the code.
Use the locations.txt file to add, remove or change locations. The structure of the locations are setup in a chronological order, followed by longitude, latitude, name of bitmap image, name of title wav file, and name of details wav file. Here's an example of a location.
Bitmap images reside on the root of the CIRCUITPY drive (Image must be in the bitmap format). The "welcome", "missing" and "acquiring fix" messages are bitmap images, as well as the green, yellow and red circles. Images of the locations can be renamed and modified – These will need to be 128 pixels by 128 pixels in size. Location image file names must match the titles in the locations.txt file.
The audio files can be changed to whatever sounds you'd like, just make sure they're in the right file format and title matches the code and locations.txt file. Audio files need to be in the following format.
- WAV, Mono PCM, 11.025kHz
See this guide on how to convert audio formats for microcontroller projects.