Basic tank-style drive robot control firmware for Freescale FRDM-K64F. Controls motors on a Dual-Full-H-Bridge with EN, like DBH-1x series, from Bluetooth serial commands

Dependencies:   mbed

Revision:
0:41ca27337c2b
Child:
2:54d27fdcbe5c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ASerial.h	Tue Jul 28 14:59:19 2015 +0000
@@ -0,0 +1,38 @@
+// Aaron Birenboim, 26jul15
+
+// Add some common Serial methods used in Arduino sketches
+//
+// Serial inherits from stream, for which I have no docuemntation.
+// examples seem to indicate that stream has (at least) printf
+
+//#include "Serial.h"
+
+class ASerial
+{
+  public:
+    Serial *_serial;
+    ASerial(Serial &s) : _serial(&s)
+    {
+        
+    }
+    
+    void print(const char *s) { _serial->puts(s);      }
+    void print(const int i  ) { _serial->printf("%d",i); }
+    void print(const float f) { _serial->printf("%.3f",f); }
+    
+    void println(const char *s) { print(s); _serial->putc('\n'); }
+    void println(const float f) { print(f); _serial->putc('\n'); }
+    
+    void baud(const int i) { _serial->baud(i); }
+
+    int readc()
+    {
+      if (_serial->readable())
+      {
+         char c = _serial->getc();
+         return((int)c);   
+      }
+      return(-1);
+    }
+};
+    
\ No newline at end of file