![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
The servo version of SCRIBE
Dependencies: BLE_nRF8001 BNO055 HC_SR04_Ultrasonic_Library mbed-rtos mbed
Fork of SCRIBE_stepper by
Diff: servo.cpp
- Revision:
- 6:91ff95c9a44e
- Child:
- 8:4d7b2dbdb694
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servo.cpp Wed May 04 23:32:45 2016 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" + +PwmOut pin25(p25); +PwmOut pin26(p26); + +void servo_reset(){ + pin25.period_ms(20); //Set the period: 20ms + pin26.period_ms(20); //Set the period: 20ms +} + +void servo_f(){ + pin25.pulsewidth_us(1300); + pin26.pulsewidth_us(1700); +} + +void servo_b(){ + pin25.pulsewidth_us(1700); + pin26.pulsewidth_us(1300); +} + +void servo_right(){ + pin25.pulsewidth_us(1700); + pin26.pulsewidth_us(1700); +} + +void servo_left(){ + pin25.pulsewidth_us(1300); + pin26.pulsewidth_us(1300); +} + +void servo_stop(){ + pin25.pulsewidth_us(1500); + pin26.pulsewidth_us(1515); +} \ No newline at end of file