Author: Stephane Constantin
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 | void setup()
{
}
void loop()
{
think();
act();
}
void think()
{
block_value = weighted_average(neighbor_data);
}
void act()
{
if(block_value>10)
{
set_drive(250);
}
else
{
set_drive(0);
}
}
|