October 7th, 2007

pce

The Song of the FreeBird!

Visit the Bird's Home!

See the bird in action! (Google video)

The board is running on a single 9V `Energizer' (similar to Duracell) battery. It works even when the voltage drops to about 7.7V! Some u-boot environment variables have been set so as to make it boot from the SD card and run an init script which loads the PWM driver and sings the following song:


#include "robolib.h"
#include <stdlib.h>

main()
{
        int i;
        robo_init();
        enable_motor(0);
        enable_motor(1);

        while(1) {
                i = 1 + (int)((4.0 * rand())/(RAND_MAX + 1.0));
                if(i == 1) {
                        forward();
                        sleep(3);
                }
                else if(i == 2) {
                        backward();
                        sleep(3);
                }
                else if(i == 3) {
                        left_turn();
                        sleep(1);
                }
                else if(i == 4){
                        right_turn();
                        sleep(1);
                }
                stop();
                sleep(1);
        }

      
}