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. Note that not every pin can own all of the abilities.

Dependencies:   BLE_API mbed nRF51822

Fork of nRF51822_SimpleControls by RedBearLab

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?

UserRevisionLine numberNew 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