Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_SimpleControls by
Servo.h@0:dfcebc1e442a, 2014-10-31 (annotated)
- Committer:
 - RedBearLab
 - Date:
 - Fri Oct 31 09:41:40 2014 +0000
 - Revision:
 - 0:dfcebc1e442a
 - Child:
 - 1:f03072e32ed3
 
First commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| RedBearLab | 0:dfcebc1e442a | 1 | #ifndef _SERVO_H | 
| RedBearLab | 0:dfcebc1e442a | 2 | #define _SERVO_H | 
| RedBearLab | 0:dfcebc1e442a | 3 | |
| RedBearLab | 0:dfcebc1e442a | 4 | #include "mbed.h" | 
| RedBearLab | 0:dfcebc1e442a | 5 | |
| RedBearLab | 0:dfcebc1e442a | 6 | class Servo | 
| RedBearLab | 0:dfcebc1e442a | 7 | { | 
| RedBearLab | 0:dfcebc1e442a | 8 | public: | 
| RedBearLab | 0:dfcebc1e442a | 9 | Servo(PinName pin); | 
| RedBearLab | 0:dfcebc1e442a | 10 | ~Servo(void); | 
| RedBearLab | 0:dfcebc1e442a | 11 | |
| RedBearLab | 0:dfcebc1e442a | 12 | void write(unsigned char degree); | 
| RedBearLab | 0:dfcebc1e442a | 13 | |
| RedBearLab | 0:dfcebc1e442a | 14 | private: | 
| RedBearLab | 0:dfcebc1e442a | 15 | void convert(unsigned char degree); | 
| RedBearLab | 0:dfcebc1e442a | 16 | |
| RedBearLab | 0:dfcebc1e442a | 17 | PwmOut _servo; | 
| RedBearLab | 0:dfcebc1e442a | 18 | unsigned int pulse; | 
| RedBearLab | 0:dfcebc1e442a | 19 | }; | 
| RedBearLab | 0:dfcebc1e442a | 20 | |
| RedBearLab | 0:dfcebc1e442a | 21 | #endif | 
