15 #if defined(BUILD_MODULE)
16 #include "module_cfg.h"
18 #include "kernel_cfg.h"
29 static int g_bluetooth_command = 0;
30 static FILE* g_bluetooth = NULL;
36 g_bluetooth = ev3_serial_open_file(EV3_SERIAL_BT);
37 assert(g_bluetooth != NULL);
44 const char* color_name[7] = {
"NONE",
"BLACK",
"WHITE",
"RED",
"BLUE",
"YELLOW",
"GREEN" };
46 controller.
printDisplay(2,
" create from github.com/korosuke613/etrobocon2018");
55 auto result = distinguisher.getColor();
56 controller.
printDisplay(4,
"HSV: %3d, %3d, %3d", static_cast<int16_t>(distinguisher.hsv.h),
57 static_cast<int16_t>(distinguisher.hsv.s),
58 static_cast<int16_t>(distinguisher.hsv.v));
61 controller.
printDisplay(7,
"Color Name: %s", color_name[static_cast<int>(result)]);
83 uint8_t c = fgetc(g_bluetooth);
86 g_bluetooth_command = 1;
91 fputc(c, g_bluetooth);
102 int32_t left_motor_counts = 0;
103 int32_t right_motor_counts = 0;
104 int log_file_number = 0;
105 char log_file_name[16];
107 while(flag ==
true) {
108 sprintf(log_file_name,
"%s%d%s",
"/Log/log", log_file_number,
".csv");
110 file = fopen(log_file_name,
"r");
113 file = fopen(log_file_name,
"a");
114 fprintf(file,
"Time(msec), Voltage, Ampere, leftMotorCounts, rightMotorCounts\n");
121 ev3_speaker_play_tone(NOTE_FS6, 200);
123 if(ev3_button_is_pressed(BACK_BUTTON)) {
124 ev3_speaker_play_tone(NOTE_FS6, 500);
130 volt = ev3_battery_voltage_mV();
131 amp = ev3_battery_current_mA();
134 fprintf(file,
"%d,%d,%d,%ld,%ld\n", time_now, volt, amp, left_motor_counts, right_motor_counts);
void tslpTsk(int16_t time)
bool buttonIsPressedBack()
void sensor_log_task(intptr_t unused)
走行体のカラーセンサを用いて、RGB情報より色を推定するクラス。
void bt_task(intptr_t unused)
void main_task(intptr_t unused)
走行体のカラーセンサを用いて、RGB情報より色を推定するクラス。
void printDisplay(int8_t row, const char *format,...)
int32_t getCount(void) const