Motor tryout, nog niet volledigwerkend.

Dependencies:   HIDScope mbed

Files at this revision

API Documentation at this revision

Comitter:
Rvs94
Date:
Sat Sep 19 10:06:45 2015 +0000
Commit message:
Switchstatement toegevoegd, maar krijg m niet werkend.

Changed in this revision

HIDScope.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 97d039743c1c HIDScope.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Sat Sep 19 10:06:45 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/tomlankhorst/code/HIDScope/#5020a2c0934b
diff -r 000000000000 -r 97d039743c1c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 19 10:06:45 2015 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "HIDScope.h"
+ 
+DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
+PwmOut motor2speed(D5);
+DigitalOut motor1direction(D7); //D6 en D7 voor motor 1 (op het motorshield)
+PwmOut motor1speed(D6);
+DigitalOut led(LED1);
+Serial pc(USBTX,USBRX);
+
+int main()
+{
+
+    pc.baud(9600);
+    char c = pc.getc();
+    while(true)
+    {
+        switch(c)
+        {
+            case 'r':
+                motor2direction = 1;
+                motor2speed = 0.5f;
+                led = 0;
+                wait(0.5f);
+                pc.printf("R\n");
+                break;
+            
+            case 't':
+                motor2direction = 0;
+                motor2speed = 0.5f;
+                led = 0;
+                wait(0.5f);
+                pc.printf("T\n");
+                break;
+            
+            default:
+                motor2direction = 0;
+                motor2speed = 0;
+                led = 1;
+        }
+     }   
+}
\ No newline at end of file
diff -r 000000000000 -r 97d039743c1c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Sep 19 10:06:45 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file