Start definitieve motorscript
Dependencies: HIDScope MODSERIAL QEI mbed
Revision 0:284ed397e046, committed 2015-09-28
- Comitter:
- Margreeth95
- Date:
- Mon Sep 28 10:25:52 2015 +0000
- Commit message:
- Motor gaat aan, maar verandert niet van richting/snelheid;
Changed in this revision
diff -r 000000000000 -r 284ed397e046 HIDScope.lib --- /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
diff -r 000000000000 -r 284ed397e046 MODSERIAL.lib --- /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
diff -r 000000000000 -r 284ed397e046 QEI.lib --- /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
diff -r 000000000000 -r 284ed397e046 main.cpp --- /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
diff -r 000000000000 -r 284ed397e046 mbed.bld --- /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