init

Files at this revision

API Documentation at this revision

Comitter:
gert_lauritsen
Date:
Wed Mar 09 13:25:12 2016 +0000
Parent:
2:467ca29e1ce0
Commit message:
Mulighed for at l?se pulsbredde tilbage; Rettet periode

Changed in this revision

throttle.cpp Show annotated file Show diff for this revision Revisions of this file
throttle.h Show annotated file Show diff for this revision Revisions of this file
diff -r 467ca29e1ce0 -r 756f6e19ee2d throttle.cpp
--- a/throttle.cpp	Mon Feb 29 16:14:57 2016 +0000
+++ b/throttle.cpp	Wed Mar 09 13:25:12 2016 +0000
@@ -1,14 +1,13 @@
 #include "throttle.h"
 
 ThrottleCtrl::ThrottleCtrl(PinName servo): _servo(servo) {
-//    MaxPos=1706; //Dette er det område vi har i første omgang
-//    MinPos=806;    
-    _servo.period(0.01);
     MaxPos=2000; //Dette er det område vi har i første omgang
-    MinPos=620;    
+    MinPos=620;  
 }
 
 
 void ThrottleCtrl::set(float pos){
-  _servo.pulsewidth_us(MinPos+pos*(MaxPos-MinPos));
+  _servo.period_ms(20);  
+  pulswidth=MinPos+pos*(MaxPos-MinPos);
+  _servo.pulsewidth_us(pulswidth);
 }
\ No newline at end of file
diff -r 467ca29e1ce0 -r 756f6e19ee2d throttle.h
--- a/throttle.h	Mon Feb 29 16:14:57 2016 +0000
+++ b/throttle.h	Wed Mar 09 13:25:12 2016 +0000
@@ -9,6 +9,7 @@
 public:
  ThrottleCtrl(PinName servo);
  int MaxPos, MinPos;
+ float pulswidth;
  void set(float pos);
 };