Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MotCon2 QEI USBDevice mbed
Revision 0:f429a7e2e92c, committed 2018-01-11
- 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
--- /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