Draws smoothly animated robot eyes on OLED displays, using the Adafruit GFX library. Robot eye shapes are configurable in terms of width, height, border radius and space between. Several different mood expressions (happy, tired, angry, default) and animations (autoblinker, idle, laughing, confused) are available. All state changes have smooth transitions and thus, complex animation sequences are easily feasible.
Developing this library was the first step of a larger project: the creation of my own DIY robot from the design perspective. Check out the FluxGarage Youtube Channel.
- Navigate to github.com/FluxGarage/RoboEyes.
- Choose "Code > Download Zip"
- In the Arduino IDE, navigate to "Sketch > Include Library > Add .ZIP Library" and select the downloaded file
- begin() (screen-width, screen-height, max framerate)
- update() update eyes drawings in the main loop, limited by max framerate as defined in begin()
- drawEyes() same as update(), but without the framerate limitation
- setWidth() (byte leftEye, byte rightEye)
- setHeight() (byte leftEye, byte rightEye)
- setBorderradius() (byte leftEye, byte rightEye)
- setSpacebetween() (int space) -> can also be negative
- setCyclops() (bool ON/OFF) -> if turned ON, robot has only on eye
- setMood() mood expression, can be TIRED, ANGRY, HAPPY, DEFAULT
- setPosition() cardinal directions, can be N, NE, E, SE, S, SW, W, NW, DEFAULT (default = horizontally and vertically centered)
- setCuriosity() (bool ON/OFF) -> when turned on, height of the outer eyes increases when moving to the very left or very right
- open() open both eyes -> open(1,0) opens left eye only
- close() close both eyes -> close(1,0) closes left eye only
Alternately displaces the eyes in the defined amplitude in pixels:
- setHFlicker() (bool ON/OFF, byte amplitude)
- setVFlicker() (bool ON/OFF, byte amplitude)
- anim_confused() confused -> eyes shaking left and right
- anim_laugh() laughing -> eyes shaking up and down
- blink() close and open both eyes
- blink(0,1) close and open right eye
Blinks both eyes randomly:
- setAutoblinker() (bool ON/OFF, int interval, int variation) -> turn on/off, set interval between each blink in full seconds, set range for additional random interval variation in full seconds
Repositions both eyes randomly:
- setIdleMode() (bool ON/OFF, int interval, int variation) -> turn on/off, set interval between each eye repositioning in full seconds, set range for additional random interval variation in full seconds