17 using namespace ev3api;
19 #if defined(BUILD_MODULE)
20 #include "module_cfg.h"
22 #include "kernel_cfg.h"
33 static int g_bluetooth_command = 0;
34 static FILE* g_bluetooth = NULL;
40 g_bluetooth = ev3_serial_open_file(EV3_SERIAL_BT);
41 assert(g_bluetooth != NULL);
46 msg_f(
"Check Colors", 1);
47 msg_f(
" create from github.com/korosuke613/etrobocon2017", 2);
54 std::string color_name[8]
55 = {
"NONE",
"BLACK",
"BLUE",
"GREEN",
"YELLOW",
"RED",
"WHITE",
"BROWN" };
63 sprintf(msg,
"ColorNumber: %s", color_name[color_num].c_str());
65 sprintf(msg,
" R:%3d G:%3d B:%3d", rgb.r, rgb.g, rgb.b);
68 sprintf(msg,
"DistanceEye: %d", sonarSensor.
getDistance());
75 sprintf(msg,
"DistanceTime: %d", time_count);
100 uint8_t c = fgetc(g_bluetooth);
103 g_bluetooth_command = 1;
108 fputc(c, g_bluetooth);
void getRawColor(rgb_raw_t &rgb) const
void main_task(intptr_t unused)
void msg_f(const char *str, int32_t line)
int16_t getDistance(void) const
colorid_t getColorNumber(void) const
void bt_task(intptr_t unused)
bool isPressed(void) const