Samenwerking Groep 12

Dependencies:   Encoder MODSERIAL HIDScope mbed

Foo

Committer:
bscheltinga
Date:
Mon Sep 21 13:55:26 2015 +0000
Revision:
11:6ddb61ebbe4b
Parent:
2:3de3c5eb400f
Motor 1 simple driver (not tested)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ThomasBNL 0:86df750eeab8 1 #include "mbed.h"
ThomasBNL 0:86df750eeab8 2 #include "HIDScope.h"
ThomasBNL 0:86df750eeab8 3 #include "encoder.h"
ThomasBNL 0:86df750eeab8 4 #include "MODSERIAL.h"
ThomasBNL 0:86df750eeab8 5
bscheltinga 11:6ddb61ebbe4b 6 //Motor 1
bscheltinga 11:6ddb61ebbe4b 7 DigitalOut motor1direction(D6); //D4 en D5 zijn motor 2 (op het motorshield)
bscheltinga 11:6ddb61ebbe4b 8 PwmOut motor1speed(D7);
ThomasBNL 0:86df750eeab8 9 DigitalIn button(PTA4);
ThomasBNL 0:86df750eeab8 10
ThomasBNL 0:86df750eeab8 11 int main()
ThomasBNL 0:86df750eeab8 12 {
ThomasBNL 0:86df750eeab8 13 while(true) {
ThomasBNL 0:86df750eeab8 14 if (button.read() == 0) {
bscheltinga 11:6ddb61ebbe4b 15 motor1direction = 1;
bscheltinga 11:6ddb61ebbe4b 16 motor1speed = 0.3f;
ThomasBNL 0:86df750eeab8 17 } else {
ThomasBNL 0:86df750eeab8 18 motor2direction = 0;
ThomasBNL 0:86df750eeab8 19 motor2speed = 0.3f;
ThomasBNL 0:86df750eeab8 20 }
ThomasBNL 0:86df750eeab8 21 }
ThomasBNL 0:86df750eeab8 22 }
ThomasBNL 0:86df750eeab8 23
ThomasBNL 0:86df750eeab8 24 // Geen functie hieronder nog
bscheltinga 11:6ddb61ebbe4b 25 //Encoder encoder1(D13,D12);