Playing with the Adafruit PyPortal Titano hardware.
The PyPortal Titano ... is our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using tinyJSON / APIs to get news, stock, weather, cat photos, and more...
Assumes a Windows host machine environment.
This setup is a little funky, but it allows for staying in VS Code while having full access to the device. An alternate approach of cloning the repo directly into the device works, but editing and other file operations are slow.
In VS Code, ensure the following extensions are installed:
- CircuitPython.
- Trigger Task on Save.
- Python, Pylance, Black, Flake8 etc. as needed
Clone the repository to a location other than the device CIRCUITPY
directory:
git clone https://github.com/thekaveman/pyportal-titano.git
Create a settings file from the sample:
cp settings.sample.toml settings.toml
Open the repository in VS Code:
cd pyportal-titano
code .
Plug the device into a USB port on the host machine, the CIRCUITPY
directory should open in Explorer.
Note the drive letter, and update args
in .vscode/tasks.json
as needed.
In the new settings file, edit WIFI_SSID
and WIFI_PASSWORD
to a local AP for Internet access.
If the RELOAD
setting is True
, the device automatically reloads and reruns main.py
when it detects file changes.
Keeping the repository files in a separate directory from the device CIRCUITPY
directory makes git
and other file
operations work as expected during development time.
- device driver code (
boot.py
,main.py
) can read application code from/app
like a normal Python package - the CircuitPython extension keeps the on-device
CircuitPython
version updated - the CircuitPython extension provides device-specific Pylance bindings to CircuitPython for the VS Code experience
- the CircuitPython extension provides a serial monitor to interact with device input/output in VS Code's terminal pane
- CircuitPython as of 8.x uses
settings.toml
to store config
The Trigger Task on Save extension does exactly what it says on the box, building on VS Code's task.json
framework. The
sync
task runs the batch script .vscode/sync.cmd
on saves to *.py
or *.toml
files, copying source code onto the device.