void ColorSensor::setup() { pinMode(_led_pin, OUTPUT); Wire.begin(); delay(1); setPassive(); }
Team ColorSensor::getTeam() { setActive(); delay(10); RGBC color = read(); setPassive(); uint16_t rdiffg = (10 * color.red) / color.green; uint16_t rdiffb = (10 * color.red) / color.blue; if (rdiffg > 20 && rdiffb > 20) { return RED; } else if (rdiffg < 9 && rdiffb > 11) { return GREEN; } else if (rdiffg < 9 && rdiffb < 9) { return BLUE; } else if (rdiffg < 13 && rdiffb > 20) { return YELLOW; } else { return UNDEF; } }
bool ColorSensor::isCovered() { setPassive(); delay(10); RGBC color = read(); return color.clear < 400; }
void Runner :: notifySendingTermination () { printDebugMessage ("I am informed that everyone received my termination notification."); setPassive (); }