Werkcollege opgave 23 september BMT K9

Dependencies:   Encoder HIDScope MODSERIAL mbed QEI biquadFilter

Committer:
bscheltinga
Date:
Wed Sep 23 08:40:48 2015 +0000
Revision:
0:fe3896c6eeb0
Child:
1:0a89274e1279
Motor 2 spinning default

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bscheltinga 0:fe3896c6eeb0 1 #include "mbed.h"
bscheltinga 0:fe3896c6eeb0 2 #include "HIDScope.h"
bscheltinga 0:fe3896c6eeb0 3 #include "encoder.h"
bscheltinga 0:fe3896c6eeb0 4 #include "MODSERIAL.h"
bscheltinga 0:fe3896c6eeb0 5
bscheltinga 0:fe3896c6eeb0 6 //Motor 2
bscheltinga 0:fe3896c6eeb0 7 DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
bscheltinga 0:fe3896c6eeb0 8 PwmOut motor2speed(D5);
bscheltinga 0:fe3896c6eeb0 9 DigitalIn button(PTA4);
bscheltinga 0:fe3896c6eeb0 10
bscheltinga 0:fe3896c6eeb0 11 int main()
bscheltinga 0:fe3896c6eeb0 12 {
bscheltinga 0:fe3896c6eeb0 13 while(true) {
bscheltinga 0:fe3896c6eeb0 14 if (button.read() == 0) {
bscheltinga 0:fe3896c6eeb0 15 motor2direction = 1;
bscheltinga 0:fe3896c6eeb0 16 motor2speed = 0.55f;
bscheltinga 0:fe3896c6eeb0 17 motor2speed = 0.3f;
bscheltinga 0:fe3896c6eeb0 18 } else {
bscheltinga 0:fe3896c6eeb0 19 motor2direction = 0;
bscheltinga 0:fe3896c6eeb0 20 motor2speed = 0.3f;
bscheltinga 0:fe3896c6eeb0 21 }
bscheltinga 0:fe3896c6eeb0 22 }
bscheltinga 0:fe3896c6eeb0 23 }