Werkend aansturingsscript voor 2 motoren, incl werkende program switch. Motoren oscilleren nog iets. Vuur mechanisme ontbreekt nog.

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of frdm_Motor_V2_2 by Margreeth de Breij

Files at this revision

API Documentation at this revision

Comitter:
Margreeth95
Date:
Mon Sep 28 10:25:52 2015 +0000
Child:
1:48aba8d5610a
Commit message:
Motor gaat aan, maar verandert niet van richting/snelheid;

Changed in this revision

HIDScope.lib Show annotated file Show diff for this revision Revisions of this file
MODSERIAL.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
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/HIDScope.lib	Mon Sep 28 10:25:52 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tomlankhorst/code/HIDScope/#5020a2c0934b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MODSERIAL.lib	Mon Sep 28 10:25:52 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MODSERIAL/#8ef4f91813fd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI.lib	Mon Sep 28 10:25:52 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/aberk/code/QEI/#5c2ad81551aa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 28 10:25:52 2015 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "MODSERIAL.h"
+#include "HIDScope.h"
+#include "QEI.h"
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut led(LED_RED);
+DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
+PwmOut motor2speed(D5);
+DigitalIn button1(SW3);
+DigitalIn EncoderA(D3);
+DigitalIn EncoderB(D2);
+HIDScope scope(2);
+Ticker ScopeTime;
+
+void ScopeSend()//Functie die de gegevens voor de scope uitleest en doorstuurt
+{
+    scope.set(0, motor2direction.read());
+    scope.set(1, motor2speed.read());
+    scope.send();
+}
+
+int main()
+{
+    motor2direction = 0;
+    motor2speed = 0;
+    wait(2);
+    led = 1;
+    pc.baud(115200);
+    pc.printf("Tot aan loop werkt");
+    ScopeTime.attach_us(&ScopeSend, 10e4);
+    
+    
+    while (true) 
+    {
+       motor2direction = 1;
+       motor2speed = 0.5f;
+       pc.printf("1\n");
+       wait(0.1);
+       pc.printf("2222222222\n");
+       motor2direction = 0;
+       motor2speed = 0.3f;
+       pc.printf("333\n");
+      
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 28 10:25:52 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file