Delta Robot example

Dependencies:   BufferedSerial Eigen

Fork of TCPSocket_Example by mbed_example

Revision:
4:778bc352c47f
Parent:
3:10fa3102c2d7
Child:
5:01e1e68309ae
--- a/odrive.cpp	Fri Oct 05 15:57:55 2018 +0000
+++ b/odrive.cpp	Sun Oct 07 19:40:12 2018 +0000
@@ -1,5 +1,5 @@
 #include "odrive.h"
-
+extern BufferedSerial buffered_pc;
 static const int kMotorOffsetFloat = 2;
 static const int kMotorStrideFloat = 28;
 static const int kMotorOffsetInt32 = 0;
@@ -70,6 +70,7 @@
     Timer timer;
     std::string str = "";
     static const unsigned long timeout = 1000;
+    timer.reset();
     timer.start();
     for (;;) {
         while (!serial_.readable ()) {
@@ -83,5 +84,14 @@
         str += c;
     }
     timer.stop();
+    buffered_pc.printf(str.c_str());
     return str;
-}
\ No newline at end of file
+}
+
+float ODrive::readBattery(){
+        std::stringstream ss;
+    ss   <<"r vbus_voltage\n" << '\n';
+    serial_.write((const uint8_t *)ss.str().c_str(),ss.str().length());
+    return readFloat();
+    
+    }
\ No newline at end of file