Author: Kristin Yen
A blinking flashlight program for a snake robot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | int lighthouse_mode=0;
void lighthouse();
void setup()
{
set_interval(1000, lighthouse);
}
void loop()
{
think();
act();
}
void think()
{
// block_value = weighted_average(neighbor_data);
}
void act()
{
//set_flashlight(250);
}
void lighthouse() {
if(lighthouse_mode==0){
set_flashlight(0);
lighthouse_mode=1;
}
else if(lighthouse_mode==1){
set_flashlight(255);
lighthouse_mode=0;
}
}
|