Easy Way
If you want to get started quickly, download the UF2 file linked below. Turn on HalloWing and connect a USB cable to your computer. Double-click HalloWing’s reset button, wait for the HALLOWBOOT drive to appear, then drag the UF2 file to this drive. After a few seconds, the code should be finished transferring and will run.
Here’s a color variant if you’d prefer, modeled after a popular sports mascot:
This will overwrite CircuitPython if it’s currently installed on your board (but your CircuitPython code and any libraries are safe).
You can restore CircuitPython easily by following the directions here.
Build From Source
Building the project from source gives you the opportunity to customize the physics a bit.
This requires the Arduino IDE software for your computer and Adafruit SAMD board support, as explained in this guide.
Several libraries are also required, which can be installed through the Arduino Library Manager(Sketch→Include Library→Manage Libraries…):
- Adafruit_LIS3DH
- Adafruit_GFX
- Adafruit_BusIO
- Adafruit_ST7735
- Adafruit_ZeroDMA
A few definitions near the top of the code determine how things behave…
#define G_SCALE 40.0 // Accel scale; no science, just looks good #define ELASTICITY 0.80 // Edge-bounce coefficient (MUST be <1.0!) #define DRAG 0.996 // Dampens motion slightly
G_SCALE
influences the pull of gravity; higher numbers = stronger gravity.
ELASTICITY
determines the “bounce” when the pupil hits an edge. 1.0 = no energy lost in the bounce, 0.0 = complete stop. This should be set somewhere between these two values, not-inclusive.
DRAG
slows the pupil movement from frame to frame, helping it come to a stop at the bottom of the eye. This too should be between 0.0 and 1.0.
The eye graphics are not easily customized, but the next page explains some of the program’s internals which experienced programmers might be able to work from.
Page last edited March 08, 2024
Text editor powered by tinymce.