WIZnet Remote Boat V1.0
Dependencies: Servo WizFi250Interface mbed
Revision 3:3e8bf06dfa83, committed 2016-04-04
- Comitter:
- jehoon
- Date:
- Mon Apr 04 09:52:21 2016 +0000
- Parent:
- 2:162fcc97fc52
- Commit message:
- modify
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 162fcc97fc52 -r 3e8bf06dfa83 main.cpp --- 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);