Fire-Fighting Robot: Shakespeare
April 2004
1st Place Trinity International Fire Fighting Robot Contest
2nd Place Abington Regional Fire-fighting Robot Contest
News Articles:
Penn State Abington – News
Penn State Live – Headline
Code:
void main()
{
//variables
int ir_on, ir_off, dist, ir_on2, ir_off2, dist2, ir3;while(1)
{
int count=0;
while(analog(3)<1)
{
}
while(analog(3)>0)
{
count++;
}
if(count>0)
{
break;
}
}
printf(“Run Program\n”);//enter loop
while(1)
{
//get IR2 distance
motor(3,100);
sleep(0.01);
ir_on2=analog(6);
sleep(0.01);
off(3);
sleep(0.01);
ir_off2=analog(6);
dist2=ir_off2-ir_on2;//get IR3 distance
ir3=analog(4);if(ir3<10)
candle();if(dist2>15)
run();//get IR1 distance
motor(0,100);
sleep(0.01);
ir_on=analog(5);
sleep(0.01);
off(0);
sleep(0.01);
ir_off=analog(5);
dist=ir_off-ir_on;if(dist>15)
{
motor(1,15);
motor(2,100);
}
else if(dist<15)
{
motor(1,100);
motor(2,15);
}
else
{
motor(1,100);
motor(2,100);
}}
}//if wall in front, back up and turn away
void run()
{
motor(1,-50);
motor(2,-50);
sleep(0.3);off(1);
motor(2,50);
sleep(0.7);
}//if sees candle, go to it and stop
void candle()
{
int ir1, ir2, ir3;ir1=ir2=15;
ir3=analog(4);
while(ir3>4)
{
ir1=analog(5);
ir2=analog(6);if(ir1>ir2)
{
motor(1,0);
motor(2,50);
}
else if(ir1<ir2)
{
motor(1,50);
motor(2,0);
}
else if(ir1==ir2)
{
motor(1,50);
motor(2,50);
}
else
{
off(1);
off(2);
}
ir3=analog(4);
}
off(1);
off(2);
sleep(1.0);
}
<a href="http://abington.psu.edu/psasite/news/roboticscomp.html">Penn State Abington - News</a>
<br> <a href="http://live.psu.edu/story/6841">Penn State Live - Headline</a>




