mit

Dependencies:   Motor_Encoders mbed Motor_Driver

Files at this revision

API Documentation at this revision

Comitter:
coldplay
Date:
Mon Dec 24 03:49:20 2018 +0000
Commit message:
mit

Changed in this revision

Motor_Driver.lib Show annotated file Show diff for this revision Revisions of this file
Motor_Encoders.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
diff -r 000000000000 -r 1fe09ed4f755 Motor_Driver.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor_Driver.lib	Mon Dec 24 03:49:20 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/TeaPack_CZ/code/Motor_Driver/#c1767d70d47e
diff -r 000000000000 -r 1fe09ed4f755 Motor_Encoders.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor_Encoders.lib	Mon Dec 24 03:49:20 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/TeaPack_CZ/code/Motor_Encoders/#48640d40223e
diff -r 000000000000 -r 1fe09ed4f755 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 24 03:49:20 2018 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "MotorDriver.h"
+#include "math.h"
+#include "Encoder.h"
+
+Serial PC(USBTX,USBRX);
+#define USBRX p14
+#define USBTX p13
+
+
+Encoder encoder(p16,p17);
+MotorDriver Motor(p21,p19,p20); // Connect to pins PWM, INA, INB
+AnalogIn senseB(p18);           //Connect to pin CS
+
+int main(){
+
+    PC.baud(115200);
+    Motor.setEnabled(true);
+    encoder.setEnabled(true);
+    int i = 0;
+  
+    while(1)
+    {
+     Motor.setSpeed(sin(i/180.0*3.1415));
+     PC.printf("%.3f\n\r",senseB.read());
+
+     wait(5);
+     PC.printf("%d\n\r",encoder.get_position());
+
+
+     wait(5);
+    }
+ }
\ No newline at end of file
diff -r 000000000000 -r 1fe09ed4f755 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Dec 24 03:49:20 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file