Speed Assignment Biorobotics

Dependencies:   Encoder mbed

Files at this revision

API Documentation at this revision

Comitter:
dbayuadi
Date:
Wed Sep 23 07:52:51 2015 +0000
Commit message:
Speed Assignment;

Changed in this revision

Encoder.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 c4fba4d6195f Encoder.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Encoder.lib	Wed Sep 23 07:52:51 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/vsluiter/code/Encoder/#18b000b443af
diff -r 000000000000 -r c4fba4d6195f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 23 07:52:51 2015 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "encoder.h"
+Serial pc(USBTX, USBRX); // tx, rx
+Encoder motor1_pos(D13,D12);
+DigitalOut motor1(D4);
+PwmOut motorspeed1(D5);
+PwmOut motorspeed2(D6);
+DigitalOut motor2(D7);
+const int on = 0;
+const int off = 1;
+const float frequency = 1000.0;
+
+int main()
+{
+    motorspeed2.period(1/frequency);
+    while (true) {
+        
+        for(float b=0.0f ; b<1.1f ; b+=0.1f)
+        {
+        motor2.write(on);
+        motorspeed2.write(b);
+        pc.printf("b is %f\n",b);
+                wait(1);
+
+        }
+        
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r c4fba4d6195f mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 23 07:52:51 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file