変な加速
P_motor.h@0:29872002539b, 2017-10-20 (annotated)
- Committer:
- fujikenac
- Date:
- Fri Oct 20 09:56:12 2017 +0000
- Revision:
- 0:29872002539b
- Child:
- 1:d0b60b54e3bd
1st commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fujikenac | 0:29872002539b | 1 | #ifndef P_motor_h_ |
fujikenac | 0:29872002539b | 2 | #define P_motor_h_ |
fujikenac | 0:29872002539b | 3 | |
fujikenac | 0:29872002539b | 4 | #include "mbed.h" |
fujikenac | 0:29872002539b | 5 | #include "T_motor.h" |
fujikenac | 0:29872002539b | 6 | |
fujikenac | 0:29872002539b | 7 | class P_motor |
fujikenac | 0:29872002539b | 8 | { |
fujikenac | 0:29872002539b | 9 | private: |
fujikenac | 0:29872002539b | 10 | T_motor motor; |
fujikenac | 0:29872002539b | 11 | Timer timer; |
fujikenac | 0:29872002539b | 12 | Serial pc; |
fujikenac | 0:29872002539b | 13 | double output[3]; |
fujikenac | 0:29872002539b | 14 | double target, output_m; |
fujikenac | 0:29872002539b | 15 | double time_old; |
fujikenac | 0:29872002539b | 16 | double RC, LC; |
fujikenac | 0:29872002539b | 17 | void compute(); |
fujikenac | 0:29872002539b | 18 | void calc(); |
fujikenac | 0:29872002539b | 19 | void timer_reset(); |
fujikenac | 0:29872002539b | 20 | void output_reset(double value = 0); |
fujikenac | 0:29872002539b | 21 | enum status |
fujikenac | 0:29872002539b | 22 | { |
fujikenac | 0:29872002539b | 23 | NONE, |
fujikenac | 0:29872002539b | 24 | FORWARD, |
fujikenac | 0:29872002539b | 25 | BACKWARD = -1 |
fujikenac | 0:29872002539b | 26 | }stat, stat_old; |
fujikenac | 0:29872002539b | 27 | |
fujikenac | 0:29872002539b | 28 | public: |
fujikenac | 0:29872002539b | 29 | P_motor(I2C *i2c_, char addr_); |
fujikenac | 0:29872002539b | 30 | P_motor& operator=(double target_); |
fujikenac | 0:29872002539b | 31 | void run(); |
fujikenac | 0:29872002539b | 32 | void free(); |
fujikenac | 0:29872002539b | 33 | void stop(); |
fujikenac | 0:29872002539b | 34 | }; |
fujikenac | 0:29872002539b | 35 | |
fujikenac | 0:29872002539b | 36 | #endif |