Joseph Bradshaw / Mbed 2 deprecated Teensy_Mot_QEI_Ser_20180111

Dependencies:   MotCon2 QEI USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
jebradshaw
Date:
Thu Jan 11 18:34:37 2018 +0000
Child:
1:9ffb6825058f
Commit message:
Teensy 3.2 QEI library encoder, USB Serial, Motor Control test

Changed in this revision

MotCon.lib Show annotated file Show diff for this revision Revisions of this file
QEI.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotCon.lib	Thu Jan 11 18:34:37 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jebradshaw/code/MotCon2/#709761ee0a14
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI.lib	Thu Jan 11 18:34:37 2018 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/aberk/code/QEI/#5c2ad81551aa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Jan 11 18:34:37 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/USBDevice/#53949e6131f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 11 18:34:37 2018 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "USBSerial.h"
+#include "MotCon.h"
+#include "QEI.h"
+
+QEI enc1(D2,D3,NC,1024, QEI::X2_ENCODING);
+MotCon mot(D4, D5);
+USBSerial pc;
+Serial ser1(D1,D0); // tx, rx
+DigitalOut led1(LED1);
+AnalogIn current(A0);
+
+int main() {
+    wait(2.0);
+    //pc.baud(9600);  //NO BAUD RATE FOR USBSerial object    
+    pc.printf("\r\n%s\r\n", __FILE__); //display the filename (this source file)
+    //pc.printf("%s %s\n",__TIME__,__DATE__);
+    pc.printf("Version 1.0 - rev %s J. Bradshaw\r\n", __DATE__);
+    
+    enc1.reset();
+    
+    while(1) {
+         for(float p=0; p<2.0*3.14159; p += 0.01) {
+            float pwm_dc = sin(p);
+            mot.mot_control(pwm_dc);
+            float encoder1 = (float)enc1.getPulses();                                                  
+            pc.printf("%7.2f %7.2f %5.3f\r\n", pwm_dc, encoder1, current.read());
+            led1 = !led1;
+            
+            wait(0.005);            
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jan 11 18:34:37 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file