encoder and tachometer class for EW3XX single board computer

Revision:
4:19ee7eb16605
Parent:
2:6cf351721d86
Child:
5:58b13292286e
--- a/EW305sbc.cpp	Tue Sep 17 23:11:49 2019 +0000
+++ b/EW305sbc.cpp	Wed Sep 25 16:05:11 2019 +0000
@@ -10,13 +10,13 @@
 
 void EW305sbc::init()
 {
-    dt_ = 0.00625; // 125 Hz
+    dt_ = 0.001; // 500 Hz, also must update lines 19 and 38 since dt_ is not working for some reason??
     speed_ = 0.0; // initial distance
     countp_ = 0;
     count_ = 0;
     angle_ = 0.0;
     /** configure the rising edge to start the timer */
-    updater.attach(callback(this, &EW305sbc::recalc), 0.00625); // 125 Hz, syntax from https://os.mbed.com/forum/mbed/topic/1964/?page=1
+    updater.attach(callback(this, &EW305sbc::recalc), 0.001); // 125 Hz, syntax from https://os.mbed.com/forum/mbed/topic/1964/?page=1
     wait(.2);   //delay at beginning for voltage settle purposes
 
     // initialize channel ch_ encoder by 
@@ -35,7 +35,7 @@
     angle_ = count_*2.0*3.14159/(4.0*pulsesPerRev_);
     
     // Estimate speed (counts/sec)
-    speed_ = -(count_-countp_)/0.00625*2.0*3.14159/(4.0*pulsesPerRev_);
+    speed_ = -(count_-countp_)/0.001*2.0*3.14159/(4.0*pulsesPerRev_);
 
     // Age variable
     countp_ = count_;