Eddie and Voula's Semi-Gargoyles

Home

Process

Code

Result


Coding

Coding began by designing basic movement functions for the ears, mouth, eye lids, and eyes. In the first version, basic abstraction was done to make referencing specific sensors, switches, and motors simpler. The first function code allowed for ALFI to go from "sleep" to "wake" (which would later become alert.)

functions1.txt

The second version of functions added new behaviors. These included yawn (opening and closing the mouth a certain number of times), eye-rove (eyes moving from left to right), sleep, alert, and bored. The break beam functions were fixed, so manual motor control was no longer needed in the eye and lid functions.

functions2.txt

The third version of functions reorganized the code to be more readable and added the unfinished initial implementation of the light sensors for detecting movement. The global variables for the saving the initial light values and the sensor name abstractions have been added, but the code to used these additions was abandoned in favor of moving to a full working program.

functions3.txt

The first stage of the full working program had two states: sleep and alert. The transitions between these states occurred when either one or both light sensors would detect less light than the initialized light level (within a certain threshold; this was done to eliminate sensor noise.) If one sensor had a much stronger reading than another, the eyes would turn towards that side. If both sensors were within a certain range of each other, the eyes would look forward. Since all light sensors vary somewhat, I tried to make for more even readings by taking the difference of the initial readings and bringing the varying sensor in closer line with the other sensor.

stage1.txt

The second stage of the program had basic versions of the three states: sleep, alert, and bored. These states followed the state diagram on the index page, with sleep moving to alert, alert moving to bored, and bored moving to either sleep or alert. The bored stage lasts 15 seconds.

stage2.txt

The third stage of the program implements more advanced version of the both alert and bored. Alert now included random blinks and ear wiggles; bored now includes blinks and yawns.

stage3.txt

The final version refined the third version. The lids now open wider for alert and bored; this helps distinguish the differences between the eyes being open, half open, and closed. Blinking is now every 5 seconds, much like human blinking. Bored now also includes ear wiggling. The randomness of the ear wiggling and yawn was also changed to make these events occur more frequently.

final.txt

The perform code was created to allow for each state and feature to be demonstrated outside of the main program to run ALFI.

perform_code.txt


Last Modified: May 25, 2009