Customizing the eye features isn’t as drag-and-drop simple…you’ll need some familiarity editing code in the Arduino IDE, installing libraries, compiling and uploading software to the HalloWing board and so forth.
Our “Electronic Animated Eyes using Teensy 3.1/3.2” guide has a link to the source code and some insights on modifying the configuration. It also explains prerequisite libraries. Here we’re focusing just on how to get two HalloWing boards talking to each other (which is not enabled in that code by default)…
In the file config.h, you’ll see a section that looks like this (starting around line 50):
// DISPLAY HARDWARE SETTINGS (screen type & connections) ------------------- #ifdef ADAFRUIT_HALLOWING #include <Adafruit_ST7735.h> // TFT display library #define DISPLAY_DC 38 // Display data/command pin #define DISPLAY_RESET 37 // Display reset pin #define DISPLAY_BACKLIGHT 7 #define BACKLIGHT_MAX 128 //#define SYNCPIN A2 // I2C sync if set, GND this pin on receiver //#define SYNCADDR 0x08 // I2C address of receiver // (Try disabling SYMMETRICAL_EYELID then) #else // Enable ONE of these #includes to specify the display type being used #include <Adafruit_SSD1351.h> // OLED display library -OR- //#include <Adafruit_ST7735.h> // TFT display library (enable one only) #define DISPLAY_DC 7 // Data/command pin for ALL displays #define DISPLAY_RESET 8 // Reset pin for ALL displays #endif
Un-comment the two SYNC lines (remove the leading “//”), like so:
#define SYNCPIN A2 // I2C sync if set, GND this pin on receiver #define SYNCADDR 0x08 // I2C address of receiver
Also, if using one of the cardboard cutouts and you haven’t made an opening for the light sensor, comment out the LIGHT_PIN
line so the pupils will change size on their own:
//#define LIGHT_PIN A1 // Hallowing light sensor pin
OPTIONAL: since we’ll have distinct left and right eyes now, you might want to enable the part of the code that gives the eyelids a more interesting shape. That’s near the top of the code, starting around line 6:
// GRAPHICS SETTINGS (appearance of eye) ----------------------------------- // If using a SINGLE EYE, you might want this next line enabled, which // uses a simpler "football-shaped" eye that's left/right symmetrical. // Default shape includes the caruncle, creating distinct left/right eyes. #ifdef ADAFRUIT_HALLOWING // Hallowing, with one eye, does this by default #define SYMMETRICAL_EYELID #else // Otherwise your choice, standard is asymmetrical //#define SYMMETRICAL_EYELID #endif
Comment out the first SYMMETRICAL_EYELID
definition like this:
//#define SYMMETRICAL_EYELID
While you’re in there, you can select one of the alternate eye designs if you like (the #include
lines near the top).
Now compile and upload the code to both boards.
More Control
If you want to create completely custom eyes…not just tweaking some settings like we’ve done here…the Electronic Animated Eyes guide explains how to delve deeper into this project and use your own images. This requires some additional skills including image editing and running Python scripts from the command line.
Page last edited March 08, 2024
Text editor powered by tinymce.