ETrobocon2017 - 片山研究所モデルベース開発推進事業部
str
apps
src
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
27
EtRobocon2017::EtRobocon2017
():
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
48
void
EtRobocon2017::loop
()
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
}
LeftCourse::setFirstCode
void setFirstCode(int32_t)
Definition:
LeftCourse.cpp:14
EtRobocon2017.h
main的なクラス
PORT_1
Definition:
Port.h:20
EtRobocon2017::EtRobocon2017
EtRobocon2017()
Definition:
EtRobocon2017.cpp:27
EtRobocon2017::loop
void loop()
Definition:
EtRobocon2017.cpp:48
ev3api::TouchSensor::isPressed
bool isPressed(void) const
Definition:
TouchSensor.cpp:20
LeftCourse::run
void run()
Definition:
LeftCourse.cpp:21
UserInterface::inputFirstCode
void inputFirstCode()
Definition:
UserInterface.cpp:9
EtRobocon2017::waitStarter
void waitStarter(int)
Definition:
EtRobocon2017.cpp:61
EtRobocon2017::start
void start(int)
Definition:
EtRobocon2017.cpp:36
RightCourse::run
void run()
Definition:
RightCourse.cpp:14
UserInterface::getFirstCode
int32_t getFirstCode()
Definition:
UserInterface.cpp:75
構築:
1.8.13