Ticker added
Dependencies: HIDScope MODSERIAL QEI mbed
Fork of Tau_new_ticker_toevoegen by
Diff: main.cpp
- Revision:
- 2:9c3713420e24
- Parent:
- 1:d2fe9abf5082
- Child:
- 3:48397c80d0e4
diff -r d2fe9abf5082 -r 9c3713420e24 main.cpp --- a/main.cpp Wed Nov 01 09:18:17 2017 +0000 +++ b/main.cpp Wed Nov 01 13:52:05 2017 +0000 @@ -28,7 +28,7 @@ QEI Encoder(A0,A1,NC,N); //Minimum wait time between rolls -float t = 1; +float t = 1.5; // Encoder measurement function void Measure() @@ -36,9 +36,9 @@ // Get pulses and send to HIDScope pulse_count = Encoder.getPulses(); - angle_pp =360/(X * N); + int angle_pp =360/(X * N); - angle = pulse_count*angle_pp; + int angle = pulse_count*angle_pp; scope.set(0, angle); scope.send(); @@ -51,13 +51,13 @@ ledr = 0; // red led on = rolling motor1PWM = 1; // motor on -> roll dice - wait(1.5); + wait(3); motor1PWM = 0; // motor off - motor1DC = abs(motor1DC-1); // rotate other way next time + //motor1DC = abs(motor1DC-1); // rotate other way next time - ledr = 1; // red led off - ledb = 0; // blue led on + //ledr = 1; // red led off + //ledb = 0; // blue led on //Encoder.reset(); }