miki sumito
/
four_wheel_omni
四輪オムニの足回りを動かすプログラム
motor/motor.hpp@0:39c2bb18192b, 2022-10-08 (annotated)
- Committer:
- m_smt
- Date:
- Sat Oct 08 11:13:31 2022 +0000
- Revision:
- 0:39c2bb18192b
move four wheel omni
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
m_smt | 0:39c2bb18192b | 1 | #ifndef MOTOR_ |
m_smt | 0:39c2bb18192b | 2 | #define MOTOR_ |
m_smt | 0:39c2bb18192b | 3 | |
m_smt | 0:39c2bb18192b | 4 | #include <mbed.h> |
m_smt | 0:39c2bb18192b | 5 | |
m_smt | 0:39c2bb18192b | 6 | #if 0 |
m_smt | 0:39c2bb18192b | 7 | ~example~ |
m_smt | 0:39c2bb18192b | 8 | Motor name(ピン名1,ピン名2)でこのクラスを使うことができるようになる |
m_smt | 0:39c2bb18192b | 9 | name.revolution(pwmの値)でモータを回すことができる |
m_smt | 0:39c2bb18192b | 10 | name.reset()でモータの値を0にする |
m_smt | 0:39c2bb18192b | 11 | #endif |
m_smt | 0:39c2bb18192b | 12 | |
m_smt | 0:39c2bb18192b | 13 | class Motor |
m_smt | 0:39c2bb18192b | 14 | { |
m_smt | 0:39c2bb18192b | 15 | public: |
m_smt | 0:39c2bb18192b | 16 | Motor(PinName pin_a,PinName pin_b); |
m_smt | 0:39c2bb18192b | 17 | void revolution(double); |
m_smt | 0:39c2bb18192b | 18 | void reset(); |
m_smt | 0:39c2bb18192b | 19 | private: |
m_smt | 0:39c2bb18192b | 20 | PwmOut motor1; |
m_smt | 0:39c2bb18192b | 21 | PwmOut motor2; |
m_smt | 0:39c2bb18192b | 22 | }; |
m_smt | 0:39c2bb18192b | 23 | |
m_smt | 0:39c2bb18192b | 24 | #endif |