18 ev3_speaker_set_volume(volume);
23 ev3_speaker_play_tone(NOTE_FS6, duration);
28 ev3_led_set_color(LED_ORANGE);
33 ev3_led_set_color(LED_GREEN);
38 return ev3_button_is_pressed(BACK_BUTTON);
43 return ev3_button_is_pressed(ENTER_BUTTON);
48 return ev3_button_is_pressed(UP_BUTTON);
53 return ev3_button_is_pressed(DOWN_BUTTON);
58 return ev3_button_is_pressed(RIGHT_BUTTON);
63 return ev3_button_is_pressed(LEFT_BUTTON);
68 return ev3_battery_voltage_mV();
74 int luminance = 0.298912 * rgb.r + 0.586611 * rgb.g + 0.114478 * rgb.b;
88 if(status.
value <= 33.5294){
89 if(status.
value <= 18.4314){
92 if(status.
hue <= 159.5357){
93 if(status.
hue <= 83.739){
94 if(status.
hue <= 40.8904){
103 if(status.
value <= 32.9412){
106 if(status.
hue <= 299.6104){
115 if(status.
value <= 45.2941){
116 if(status.
hue <= 263.0811){
117 if(status.
hue <= 32.8235){
120 if(status.
hue <= 76.7547){
121 if(status.
hue <= 44.8367){
122 if(status.
hue <= 40.5263){
131 if(status.
value <= 40.1961){
132 if(status.
value <= 35.4902){
146 if(status.
hue <= 283.6016){
147 if(status.
hue <= 99.2199){
148 if(status.
value <= 51.1765){
170 ev3_lcd_fill_rect(x, y, EV3_LCD_WIDTH, h, EV3_LCD_WHITE);
175 ev3_lcd_draw_string(str, x, y);
180 ev3_lcd_set_font(EV3_FONT_SMALL);
185 return leftWheel.getCount();
190 return rightWheel.getCount();
193 int Controller::suppressPwmValue(
const int value)
205 leftWheel.setPWM(suppressPwmValue(pwm));
210 rightWheel.setPWM(suppressPwmValue(pwm));
228 if(r == g && r == b) hsv.
hue = 0;
233 if(max - min != 0) max += 1;
234 hsv.
hue = 60 * ((g - b) / (max - min));
239 if(max - min != 0) max += 1;
240 hsv.
hue = 60 * ((b - r) / (max - min)) + 120;
245 if(max - min != 0) max += 1;
246 hsv.
hue = 60 * ((r - g) / (max - min)) + 240;
249 if(hsv.
hue < 0) hsv.
hue += 360;
252 if(max - min != 0) max += 1;
258 hsv.
value = max / 255 * 100;
static constexpr int MOTOR_PWM_MAX
bool buttonIsPressedBack()
bool buttonIsPressedLeft()
bool buttonIsPressedRight()
static void speakerPlayToneFS6(int duration)
void setLeftMotorPwm(const int pwm)
Color hsvToColor(const HsvStatus &status)
static float getBatteryVoltage()
static void lcdDrawString(const char *str, int x, int y)
void convertHsv(int &r, int &g, int &b)
void setRightMotorPwm(const int pwm)
static void tslpTsk(int time)
bool buttonIsPressedEnter()
bool buttonIsPressedDown()
static void lcdFillRect(int x, int y, int h)
int limitAngle(int angle)
void getRawColor(int &r, int &g, int &b)
static constexpr int MOTOR_PWM_MIN
void speakerSetVolume(int volume)