Cubelet.7956.c

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
void setup()
{

}

void loop()
{
    think();
    act();
}

void think()
{
    block_value = weighted_average(neighbor_data);
}

void act()
{
    if(block_value>20)
    {
        set_drive(0);
    }
    else
    {
        set_drive(250);   
    }
}