Ian Krase / PolyServo

Dependents:   Quadrapod

Files at this revision

API Documentation at this revision

Comitter:
ikrase
Date:
Sat Jun 27 06:37:14 2015 +0000
Parent:
2:f982504e6e84
Child:
4:32fa20b74c9c
Commit message:
Started work on specified timeout.

Changed in this revision

PolyServo.cpp Show annotated file Show diff for this revision Revisions of this file
PolyServo.h Show annotated file Show diff for this revision Revisions of this file
SpecifiedTimeout.h Show annotated file Show diff for this revision Revisions of this file
--- a/PolyServo.cpp	Sat Jun 27 06:08:17 2015 +0000
+++ b/PolyServo.cpp	Sat Jun 27 06:37:14 2015 +0000
@@ -3,6 +3,7 @@
 #include "mbed.h"
 #include "FPointer.h"
 #include <vector>
+#include "SpecifiedTimeout.h"
 
 
 Polyservo::Polyservo(DigitalOut servo_pins[], int num_pins): numservos(num_pins) {
@@ -26,8 +27,10 @@
 void Polyservo::servos_reset(void){
     for(int i=0; i< numservos; i++) {
         if (global_enable && positions[i] != SERVO_DISABLED){
-            
-            
+            servos[i]->write(1);
+            servo_timers[i]->attach_us(this,&Polyservo::servo_set,positions[i]);
+        } else {
+            servos[i]->write(0);
         }
         
     }
--- a/PolyServo.h	Sat Jun 27 06:08:17 2015 +0000
+++ b/PolyServo.h	Sat Jun 27 06:37:14 2015 +0000
@@ -4,6 +4,7 @@
 #include "mbed.h"
 #include "FPointer.h"
 #include <vector>
+#include "SpecifiedTimeout.h"
 
 
 #define SERVO_DISABLED -1       // This is going to take raw servo microsecond entries.