Junichi Katsu
/
wallbotLED_base
うおーるぼっとLEDのワークショップ用
wallbotLED/TB6612/TB6612.h@3:b707c09b4433, 2017-02-04 (annotated)
- Committer:
- jksoft
- Date:
- Sat Feb 04 03:33:08 2017 +0000
- Revision:
- 3:b707c09b4433
- Parent:
- 0:9fcc79b3f00e
????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:9fcc79b3f00e | 1 | /** |
jksoft | 0:9fcc79b3f00e | 2 | * Motor Driver TB6612 Control Library |
jksoft | 0:9fcc79b3f00e | 3 | * |
jksoft | 0:9fcc79b3f00e | 4 | * -- TB6612 is a device of the rohm. |
jksoft | 0:9fcc79b3f00e | 5 | * |
jksoft | 0:9fcc79b3f00e | 6 | * Copyright (C) 2012 Junichi Katsu (JKSOFT) |
jksoft | 0:9fcc79b3f00e | 7 | */ |
jksoft | 0:9fcc79b3f00e | 8 | |
jksoft | 0:9fcc79b3f00e | 9 | #ifndef MBED_TB6612_H |
jksoft | 0:9fcc79b3f00e | 10 | #define MBED_TB6612_H |
jksoft | 0:9fcc79b3f00e | 11 | |
jksoft | 0:9fcc79b3f00e | 12 | #include "mbed.h" |
jksoft | 0:9fcc79b3f00e | 13 | |
jksoft | 0:9fcc79b3f00e | 14 | class TB6612 { |
jksoft | 0:9fcc79b3f00e | 15 | public: |
jksoft | 0:9fcc79b3f00e | 16 | TB6612(PinName pwm, PinName fwd, PinName rev); |
jksoft | 0:9fcc79b3f00e | 17 | void speed(float speed); |
jksoft | 0:9fcc79b3f00e | 18 | void move(float speed , float time); |
jksoft | 0:9fcc79b3f00e | 19 | void operator= ( float value ) |
jksoft | 0:9fcc79b3f00e | 20 | { |
jksoft | 0:9fcc79b3f00e | 21 | speed(value); |
jksoft | 0:9fcc79b3f00e | 22 | } |
jksoft | 0:9fcc79b3f00e | 23 | |
jksoft | 0:9fcc79b3f00e | 24 | protected: |
jksoft | 0:9fcc79b3f00e | 25 | PwmOut _pwm; |
jksoft | 0:9fcc79b3f00e | 26 | DigitalOut _fwd; |
jksoft | 0:9fcc79b3f00e | 27 | DigitalOut _rev; |
jksoft | 0:9fcc79b3f00e | 28 | Timeout timer; |
jksoft | 0:9fcc79b3f00e | 29 | float bspeed; |
jksoft | 0:9fcc79b3f00e | 30 | bool timer_flag; |
jksoft | 0:9fcc79b3f00e | 31 | void timeout(); |
jksoft | 0:9fcc79b3f00e | 32 | |
jksoft | 0:9fcc79b3f00e | 33 | }; |
jksoft | 0:9fcc79b3f00e | 34 | |
jksoft | 0:9fcc79b3f00e | 35 | #endif |