Samenwerking Groep 12
Dependencies: Encoder MODSERIAL HIDScope mbed
Foo
main.cpp@2:3de3c5eb400f, 2015-09-21 (annotated)
- Committer:
- bscheltinga
- Date:
- Mon Sep 21 09:59:58 2015 +0000
- Revision:
- 2:3de3c5eb400f
- Parent:
- 1:73c4c9192d80
- Child:
- 3:61c024f896ad
- Child:
- 11:6ddb61ebbe4b
changed motor2speed to 0.3
Who changed what in which revision?
User | Revision | Line number | New 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 | |
ThomasBNL | 0:86df750eeab8 | 6 | //Motor 2 |
ThomasBNL | 0:86df750eeab8 | 7 | DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) |
ThomasBNL | 0:86df750eeab8 | 8 | PwmOut motor2speed(D5); |
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) { |
ThomasBNL | 0:86df750eeab8 | 15 | motor2direction = 1; |
bscheltinga | 2:3de3c5eb400f | 16 | motor2speed = 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 |
ThomasBNL | 0:86df750eeab8 | 25 | Encoder encoder1(D13,D12); |