motorspeed step
Dependencies: Encoder MODSERIAL mbed
Fork of frdm_Motortryout2_test by
main.cpp@5:8affd11a5674, 2015-10-22 (annotated)
- Committer:
- Rvs94
- Date:
- Thu Oct 22 12:29:39 2015 +0000
- Revision:
- 5:8affd11a5674
- Parent:
- 4:f11dacf12ca7
Motor test vanwege staprespons motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rvs94 | 0:c8684fed9b61 | 1 | #include "mbed.h" |
Rvs94 | 0:c8684fed9b61 | 2 | #include "encoder.h" |
Rvs94 | 0:c8684fed9b61 | 3 | #include "MODSERIAL.h" |
Rvs94 | 0:c8684fed9b61 | 4 | |
Rvs94 | 0:c8684fed9b61 | 5 | Serial pc(USBTX, USBRX); // tx, rx |
Rvs94 | 3:051c91b04acd | 6 | DigitalOut led(LED_RED); |
Rvs94 | 0:c8684fed9b61 | 7 | DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) |
Rvs94 | 0:c8684fed9b61 | 8 | PwmOut motor2speed(D5); |
Rvs94 | 0:c8684fed9b61 | 9 | |
Rvs94 | 0:c8684fed9b61 | 10 | int main() |
Rvs94 | 0:c8684fed9b61 | 11 | { |
Margreeth95 | 4:f11dacf12ca7 | 12 | //test |
Rvs94 | 3:051c91b04acd | 13 | motor2direction = 0; |
Rvs94 | 0:c8684fed9b61 | 14 | motor2speed = 0; |
Rvs94 | 3:051c91b04acd | 15 | led = 1; |
Rvs94 | 5:8affd11a5674 | 16 | pc.baud(115200); |
Rvs94 | 0:c8684fed9b61 | 17 | while(true) |
Rvs94 | 0:c8684fed9b61 | 18 | { |
Rvs94 | 5:8affd11a5674 | 19 | char c = pc.getc(); |
Rvs94 | 5:8affd11a5674 | 20 | if( c == 'r') |
Rvs94 | 5:8affd11a5674 | 21 | { |
Rvs94 | 5:8affd11a5674 | 22 | motor2speed = 1; |
Rvs94 | 5:8affd11a5674 | 23 | } |
Rvs94 | 0:c8684fed9b61 | 24 | } |
Rvs94 | 0:c8684fed9b61 | 25 | } |