SimpleControls works with the BLEController iOS/Android App. The mbed's pin can acts as DIGITAL_IN, DIGITAL_OUT, PWM, SERVO, ANALOG_IN. The sketch is to show you how to control the pin as one of the abilities.
Dependencies: BLE_API mbed nRF51822
Fork of BLENano_SimpleControls by
Servo.h@0:be2e4095513a, 2014-10-31 (annotated)
- Committer:
- RedBearLab
- Date:
- Fri Oct 31 09:47:34 2014 +0000
- Revision:
- 0:be2e4095513a
- Child:
- 1:81a97eb70d3d
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RedBearLab | 0:be2e4095513a | 1 | #ifndef _SERVO_H |
RedBearLab | 0:be2e4095513a | 2 | #define _SERVO_H |
RedBearLab | 0:be2e4095513a | 3 | |
RedBearLab | 0:be2e4095513a | 4 | #include "mbed.h" |
RedBearLab | 0:be2e4095513a | 5 | |
RedBearLab | 0:be2e4095513a | 6 | class Servo |
RedBearLab | 0:be2e4095513a | 7 | { |
RedBearLab | 0:be2e4095513a | 8 | public: |
RedBearLab | 0:be2e4095513a | 9 | Servo(PinName pin); |
RedBearLab | 0:be2e4095513a | 10 | ~Servo(void); |
RedBearLab | 0:be2e4095513a | 11 | |
RedBearLab | 0:be2e4095513a | 12 | void write(unsigned char degree); |
RedBearLab | 0:be2e4095513a | 13 | |
RedBearLab | 0:be2e4095513a | 14 | private: |
RedBearLab | 0:be2e4095513a | 15 | void convert(unsigned char degree); |
RedBearLab | 0:be2e4095513a | 16 | |
RedBearLab | 0:be2e4095513a | 17 | PwmOut _servo; |
RedBearLab | 0:be2e4095513a | 18 | unsigned int pulse; |
RedBearLab | 0:be2e4095513a | 19 | }; |
RedBearLab | 0:be2e4095513a | 20 | |
RedBearLab | 0:be2e4095513a | 21 | #endif |