Wang Xinglu
/
LinkNode_LIS3DH
MolCom
Fork of LinkNode_LIS3DH by
Servo.h@13:2eea65e05867, 2016-05-11 (annotated)
- Committer:
- luzai
- Date:
- Wed May 11 04:27:09 2016 +0000
- Revision:
- 13:2eea65e05867
- Parent:
- 12:2d16b571ec3b
MolCom;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
luzai | 12:2d16b571ec3b | 1 | /* |
luzai | 12:2d16b571ec3b | 2 | |
luzai | 12:2d16b571ec3b | 3 | Copyright (c) 2012-2014 RedBearLab |
luzai | 12:2d16b571ec3b | 4 | |
luzai | 12:2d16b571ec3b | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
luzai | 12:2d16b571ec3b | 6 | and associated documentation files (the "Software"), to deal in the Software without restriction, |
luzai | 12:2d16b571ec3b | 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
luzai | 12:2d16b571ec3b | 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
luzai | 12:2d16b571ec3b | 9 | subject to the following conditions: |
luzai | 12:2d16b571ec3b | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
luzai | 12:2d16b571ec3b | 11 | |
luzai | 12:2d16b571ec3b | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
luzai | 12:2d16b571ec3b | 13 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
luzai | 12:2d16b571ec3b | 14 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
luzai | 12:2d16b571ec3b | 15 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
luzai | 12:2d16b571ec3b | 16 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
luzai | 12:2d16b571ec3b | 17 | |
luzai | 12:2d16b571ec3b | 18 | */ |
luzai | 12:2d16b571ec3b | 19 | |
luzai | 12:2d16b571ec3b | 20 | #ifndef _SERVO_H |
luzai | 12:2d16b571ec3b | 21 | #define _SERVO_H |
luzai | 12:2d16b571ec3b | 22 | |
luzai | 12:2d16b571ec3b | 23 | #include "mbed.h" |
luzai | 12:2d16b571ec3b | 24 | |
luzai | 12:2d16b571ec3b | 25 | class Servo |
luzai | 12:2d16b571ec3b | 26 | { |
luzai | 12:2d16b571ec3b | 27 | public: |
luzai | 12:2d16b571ec3b | 28 | Servo(PinName pin); |
luzai | 12:2d16b571ec3b | 29 | ~Servo(void); |
luzai | 12:2d16b571ec3b | 30 | |
luzai | 12:2d16b571ec3b | 31 | void write(unsigned char degree); |
luzai | 12:2d16b571ec3b | 32 | |
luzai | 12:2d16b571ec3b | 33 | private: |
luzai | 12:2d16b571ec3b | 34 | void convert(unsigned char degree); |
luzai | 12:2d16b571ec3b | 35 | |
luzai | 12:2d16b571ec3b | 36 | PwmOut _servo; |
luzai | 12:2d16b571ec3b | 37 | unsigned int pulse; |
luzai | 12:2d16b571ec3b | 38 | }; |
luzai | 12:2d16b571ec3b | 39 | |
luzai | 12:2d16b571ec3b | 40 | #endif |