ETrobocon2017 - 片山研究所モデルベース開発推進事業部
EtRobocon2017.cpp
[詳解]
1 #include "EtRobocon2017.h"
2 
9 /*
10  * touch_sensor = EV3_PORT_1;
11  * sonar_sensor = EV3_PORT_2;
12  * color_sensor = EV3_PORT_3;
13  * gyro_sensor = EV3_PORT_4;
14  *
15  * left_motor = EV3_PORT_C;
16  * right_motor = EV3_PORT_B;
17  * lift_motor = EV3_PORT_A;
18  * tail_motor = EV3_PORT_D;
19  */
20 
28  touchSensor( PORT_1 )
29 {
30  light_white = 60;
31  light_black = 0;
33  ev3_speaker_set_volume(100);
34 }
35 
36 void EtRobocon2017::start( int bluetooth_command )
37 {
38  ui.inputFirstCode();
39  firstCode = ui.getFirstCode();
40  ev3_led_set_color(LED_ORANGE);
41  waitStarter( bluetooth_command );
42 
43  ev3_led_set_color(LED_GREEN); /* スタート通知 */
44 
45  loop();
46 }
47 
49 {
50 // Rコースを走らせるときは1, Lコースを走らせるときは0
51 
52 #if 0
53  rightCourse.run();
54 #else
55  leftCourse.setFirstCode( firstCode );
56  leftCourse.run();
57 #endif
58 
59 }
60 
61 void EtRobocon2017::waitStarter( int bluetooth_command )
62 {
63  /* スタート待機 */
64  while(1)
65  {
66  if (bluetooth_command == 1)
67  {
68  break; /* リモートスタート */
69  }
70 
71  if ( touchSensor.isPressed()== 1)
72  {
73  tslp_tsk(500);
74  break; /* タッチセンサが押された */
75  }
76 
77  tslp_tsk(10); /* 10msecウェイト */
78  }
79 }
void setFirstCode(int32_t)
Definition: LeftCourse.cpp:14
main的なクラス
Definition: Port.h:20
bool isPressed(void) const
Definition: TouchSensor.cpp:20
void run()
Definition: LeftCourse.cpp:21
void inputFirstCode()
void waitStarter(int)
void start(int)
int32_t getFirstCode()