etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
Controller.h
[詳解]
1 #ifndef __CONTROLLER__
2 #define __CONTROLLER__
3 
4 #include "ev3api.h"
5 
6 #include "Clock.h"
7 #include "ColorSensor.h"
8 #include "Motor.h"
9 #include "TouchSensor.h"
10 #include <stdarg.h>
11 
12 /*
13  * touch_sensor = EV3_PORT_1;
14  * sonar_sensor = EV3_PORT_2;
15  * color_sensor = EV3_PORT_3;
16  * gyro_sensor = EV3_PORT_4;
17  *
18  * left_motor = EV3_PORT_C;
19  * right_motor = EV3_PORT_B;
20  * lift_motor = EV3_PORT_A;
21  * tail_motor = EV3_PORT_D;
22  */
23 
24 using namespace ev3api;
25 
26 extern void init_f(const char* str);
27 extern void msg_f(const char* str, int32_t line);
28 
29 class Controller {
30  public:
32  : touchSensor(PORT_1),
33  colorSensor(PORT_3),
34  liftMotor(PORT_A),
35  rightWheel(PORT_B),
36  leftWheel(PORT_C),
37  tailMotor(PORT_D)
38  {
39  }
40  uint16_t noteFs6 = NOTE_FS6;
41  uint16_t noteFs4 = NOTE_FS4;
49  void speakerSetVolume(uint8_t volume);
50  void ledSetColorOrange();
51  void ledSetColorGreen();
52  int16_t getBrightness();
53  void speakerPlayTone(uint16_t frequency, int32_t duration);
54  bool buttonIsPressedBack();
55  bool buttonIsPressedUp();
56  bool buttonIsPressedDown();
57  bool buttonIsPressedRight();
58  bool buttonIsPressedLeft();
59  bool buttonIsPressedEnter();
60  float measureBatteryVoltage();
61  void tslpTsk(int16_t time); // 4msec周期起動
62  void printDisplay(int8_t row, const char* format, ...);
63  void getRawColor(uint16_t& r, uint16_t& g, uint16_t& b);
64 
65  private:
66  rgb_raw_t rgb;
67  char msg[32];
68 };
69 #endif
TouchSensor touchSensor
Definition: Controller.h:42
Motor liftMotor
Definition: Controller.h:44
Definition: Port.h:20
void msg_f(const char *str, int32_t line)
Definition: util.cpp:17
Clock clock
Definition: Controller.h:48
Definition: Port.h:32
Definition: Port.h:22
Definition: Port.h:33
void init_f(const char *str)
Definition: util.cpp:6
Motor tailMotor
Definition: Controller.h:47
ColorSensor colorSensor
Definition: Controller.h:43
Motor leftWheel
Definition: Controller.h:46
Definition: Port.h:34
Definition: Port.h:31
Motor rightWheel
Definition: Controller.h:45