
motor aansturing moet lineair zijn is het niet
Dependencies: MODSERIAL Encoder mbed HIDScope
Diff: main.cpp
- Revision:
- 1:8918d924f625
- Parent:
- 0:5ea1875b307a
- Child:
- 2:bcd68150136c
--- a/main.cpp Mon Sep 28 08:54:05 2015 +0000 +++ b/main.cpp Mon Sep 28 09:14:12 2015 +0000 @@ -23,8 +23,9 @@ void move_mot1(float left) { if(left < 0.4) - { - motor1_aan.write(1); + { + float leftin = left*2.5 ; + motor1_aan.write(leftin); motor1_rich.write(0); } else if(left > 0.4 && left < 0.6) @@ -33,7 +34,10 @@ } else if(left > 0.6) { - motor1_aan.write(1); + float calc = left - 1; + float calc2 = abs(calc); + float leftin = calc2*2.5; + motor1_aan.write(leftin); motor1_rich.write(1); } } @@ -42,7 +46,8 @@ { if(right < 0.4) { - motor2_aan.write(1); + float rightin = right*2.5; + motor2_aan.write(rightin); motor2_rich.write(0); } else if(right > 0.4 && right < 0.6) @@ -51,7 +56,10 @@ } else if(right > 0.6) { - motor2_aan.write(1); + float calc3 = right-1; + float calc4 = abs(calc3); + float rightin = calc4*2.5; + motor2_aan.write(rightin); motor2_rich.write(1); } }