전시회용
Dependencies: Servo WizFi250Interface mbed
Fork of Remote_Boat_WIZwiki-W7500ECO_WizFi250 by
Diff: main.cpp
- Revision:
- 1:91f8a27fc9a0
- Parent:
- 0:5bf873326d8c
- Child:
- 2:162fcc97fc52
--- a/main.cpp Mon Mar 28 06:48:38 2016 +0000 +++ b/main.cpp Wed Mar 30 06:11:24 2016 +0000 @@ -52,6 +52,7 @@ { char rcvBuf[1024] = {0,}; int len = 0; + switch(ConnectionStep) { case DISASSOCIATED: @@ -65,8 +66,7 @@ case CONNECTED: - int isconnected = client.is_connected(); - if( isconnected == 0 ) ConnectionStep = DISCONNECTED; + if( client.is_connected() == 0 ) ConnectionStep = DISCONNECTED; if( wizfi250.readable(0) > 0 ) { @@ -76,12 +76,12 @@ { if( strcmp(rcvBuf,forward) == 0 ) { - speed = speed + 0.5; + speed = speed + 0.05; printf("forward\r\n"); } else if( strcmp(rcvBuf,back) == 0 ) { - speed = speed - 0.5; + speed = speed - 0.05; printf("back\r\n"); } else if( strcmp(rcvBuf,left) == 0 ) @@ -102,7 +102,7 @@ } if( speed < 0.0 ) speed = 0.0; - else if ( speed > 255.0 ) speed = 255.0; + else if ( speed > 1.0 ) speed = 1.0; printf("speed %.3f\r\n", speed); motor.write(speed); } @@ -112,13 +112,8 @@ servo = 0.5; motor.write(0); ConnectionStep = LISTENED; - - } - } - - } int TryApUp()