14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

B.1. Microprocessor Code 87<br />

/* Configure <strong>the</strong> USB */<br />

USB_Configuration();<br />

USB_Init();<br />

LED_ON(LEDR);<br />

MSDelay(200);<br />

LED_OFF(LEDR);<br />

MSDelay(200);<br />

LED_ON(LEDR);<br />

MSDelay(200);<br />

LED_OFF(LEDR);<br />

MSDelay(200);<br />

LED_ON(LEDR);<br />

MSDelay(200);<br />

LED_OFF(LEDR);<br />

/* To initialize camera parameters*/<br />

Init_Cam();<br />

/* To initialize motors, configure pins and PWM values*/<br />

Init_Motors();<br />

/* To arrange camera head position<br />

* available position SERVO_TOP ,SERVO_MID ,SERVO_BOTTOM<br />

* */<br />

Position_Camera(SERVO_TOP);<br />

/* To initialize bumpers, and configure pins */<br />

Init_Bumpers();<br />

MSDelay(2000);<br />

/* To define blob color & geometry */<br />

Init_BlobParameters();<br />

/* <strong>the</strong> initial values */<br />

bool search_direction = TRUE;<br />

u8 game_end = 0;<br />

bool blob_found = FALSE;<br />

bool color_done = FALSE;<br />

u8 cam_position = SERVO_TOP;<br />

u8 counter = 0;<br />

u8 color = 1;<br />

s16 speed[3];<br />

u8 replay_counter = 0;<br />

while (1) {<br />

/*reading <strong>the</strong> bumpers values */<br />

u8 check_bumpers[6] = { 0 };<br />

Bumpers(check_bumpers);<br />

/*to blink led*/<br />

Led_SM();<br />

/* controlling whe<strong>the</strong>r <strong>the</strong> first target acquired */

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!