전시회용
Dependencies: Servo WizFi250Interface mbed
Fork of Remote_Boat_WIZwiki-W7500ECO_WizFi250 by
Diff: main.cpp
- Revision:
- 3:3e8bf06dfa83
- Parent:
- 2:162fcc97fc52
- Child:
- 4:ecce8d101cde
--- a/main.cpp Wed Mar 30 08:30:58 2016 +0000 +++ b/main.cpp Mon Apr 04 09:52:21 2016 +0000 @@ -45,7 +45,7 @@ int main() { pc.baud(115200); - motor.period_ms(1); + motor.period_us(1000000/490); float speed = 0.0; while(1) @@ -76,12 +76,12 @@ { if( strcmp(rcvBuf,forward) == 0 ) { - speed = speed + 0.05; + speed = speed + 0.01; printf("forward\r\n"); } else if( strcmp(rcvBuf,back) == 0 ) { - speed = speed - 0.05; + speed = speed - 0.01; printf("back\r\n"); } else if( strcmp(rcvBuf,left) == 0 ) @@ -101,7 +101,7 @@ printf("stop\r\n"); } - if( speed < 0.0 ) speed = 0.0; + if( speed < 0.55 ) speed = 0.55; else if ( speed > 1.0 ) speed = 1.0; printf("speed %.3f\r\n", speed); motor.write(speed);