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

Committer:
Mr_What
Date:
Tue Jul 28 14:59:19 2015 +0000
Revision:
0:41ca27337c2b
Child:
2:54d27fdcbe5c
sloppy Arduino port, but (mostly) running.  Ready to test motor drive.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mr_What 0:41ca27337c2b 1 // Aaron Birenboim, 26jul15
Mr_What 0:41ca27337c2b 2
Mr_What 0:41ca27337c2b 3 // Add some common Serial methods used in Arduino sketches
Mr_What 0:41ca27337c2b 4 //
Mr_What 0:41ca27337c2b 5 // Serial inherits from stream, for which I have no docuemntation.
Mr_What 0:41ca27337c2b 6 // examples seem to indicate that stream has (at least) printf
Mr_What 0:41ca27337c2b 7
Mr_What 0:41ca27337c2b 8 //#include "Serial.h"
Mr_What 0:41ca27337c2b 9
Mr_What 0:41ca27337c2b 10 class ASerial
Mr_What 0:41ca27337c2b 11 {
Mr_What 0:41ca27337c2b 12 public:
Mr_What 0:41ca27337c2b 13 Serial *_serial;
Mr_What 0:41ca27337c2b 14 ASerial(Serial &s) : _serial(&s)
Mr_What 0:41ca27337c2b 15 {
Mr_What 0:41ca27337c2b 16
Mr_What 0:41ca27337c2b 17 }
Mr_What 0:41ca27337c2b 18
Mr_What 0:41ca27337c2b 19 void print(const char *s) { _serial->puts(s); }
Mr_What 0:41ca27337c2b 20 void print(const int i ) { _serial->printf("%d",i); }
Mr_What 0:41ca27337c2b 21 void print(const float f) { _serial->printf("%.3f",f); }
Mr_What 0:41ca27337c2b 22
Mr_What 0:41ca27337c2b 23 void println(const char *s) { print(s); _serial->putc('\n'); }
Mr_What 0:41ca27337c2b 24 void println(const float f) { print(f); _serial->putc('\n'); }
Mr_What 0:41ca27337c2b 25
Mr_What 0:41ca27337c2b 26 void baud(const int i) { _serial->baud(i); }
Mr_What 0:41ca27337c2b 27
Mr_What 0:41ca27337c2b 28 int readc()
Mr_What 0:41ca27337c2b 29 {
Mr_What 0:41ca27337c2b 30 if (_serial->readable())
Mr_What 0:41ca27337c2b 31 {
Mr_What 0:41ca27337c2b 32 char c = _serial->getc();
Mr_What 0:41ca27337c2b 33 return((int)c);
Mr_What 0:41ca27337c2b 34 }
Mr_What 0:41ca27337c2b 35 return(-1);
Mr_What 0:41ca27337c2b 36 }
Mr_What 0:41ca27337c2b 37 };
Mr_What 0:41ca27337c2b 38