This program demonstrate how to apply BLE_nRF8001 library on mbed platform working with RedBearLab BLE Shield v2.1 or above.
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. You can change the following macro to specify which pin to be controlled.
DigitalInOut DIGITAL_OUT_PIN( PTD4 );
DigitalInOut DIGITAL_IN_PIN( PTA12 );
PwmOut pwm( PTA4 );
Servo myservo( PTA13 );
AnalogIn analog( PTB0 );
The application will report the state of DIGITAL_IN_PIN and ANALOG_IN_PIN to App. The App can control the state of DIGITAL_OUT_PIN / PWM_PIN / SERVO_PIN.
You have to change the belowing constructs manually corresponding to the platform you are using.
SPI spi(PTD2, PTD3, PTD1);