This project library brings in a considerable number of dependencies and takes a looong time to compile using Arduino IDE. If you want to modify the code in this guide, you'll want to compile the project using PlatformIO rather than Arduino IDE.
Install PlatformIO
Follow this page's instructions to install PlatformIO and Visual Studio Code (the IDE of choice for using PlatformIO).
Configure Your Workspace
The ZIP file below includes a pre-configured workspace for using PlatformIO. Download and unzip this file. Then, save it somewhere safe, like your desktop.
Open Visual Studio Code (VSCode). To ensure you have installed the PlatformIO extension properly, look for the alien symbol in your VSCode sidebar.
Underneath Start, click Open...
Navigate to the folder created when you unzipped the zip file. Then, Click Open to open the workspace.
A large amount of configuration files and directories will appear in your VSCode instance.
To compile this code, we are only going to discuss the following files and directories:
- platformio.ini - This is the project configuration file used to build the demo code. More documentation about this file is located here.
-
lib directory - This directory is intended for project-specific (private) libraries. PlatformIO will compile them to static libraries and link them into executable files.
- For our project, the specific library within this directory is the Adafruit_PyCamera library.
- src directory - The directory where the project's source code, main.cpp, is located as well as the included headers (such as ra_filter.h which stores the facial recognition/detection overhead).
Build and Upload with PlatformIO
Before the code is built, you'll need to make two changes to the platformio.ini file:
- Change
upload_port
to reflect the MEMENTO's upload port. -
The
monitor_port
is different from theupload_port
, and will only appear on your computer when you've uploaded the test code. For now, leave this alone.- After uploading the test code, change
monitor_port
to reflect the MEMENTO's monitor/serial port.
- After uploading the test code, change
Navigate to src/main.cpp
to open the example code.
With this file open, click the Alien symbol on the VSCode sidebar to open the PlatformIO Project Explorer.
Underneath PlatformIO's Project Tasks, click Build.
Once the build task is completed, the terminal will show SUCCESS
along with the time it took to compile the project.
Before uploading this project to the board, put the board into ROM Bootloader Mode.
From the PlatformIO Project Tasks menu, click Upload.
Once the upload completes, the terminal should look like the following screenshot and show SUCCESS
.
Press the RST (Reset) button on the MEMENTO to run the uploaded code.
After the board resets, you'll see a preview of what the camera module is seeing on the MEMENTO display. Follow the "Usage" page in this guide for detailed usage instructions.
Congrats - you have successfully compiled and uploaded the example code. You may make any modifications or extensions to this code that you'd like!
Page last edited March 08, 2024
Text editor powered by tinymce.