Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Communication_Robot QEI iSerial mbed motion_control
Fork of dog_V3_2_testmotor by
Diff: main.cpp
- Revision:
- 7:6a99be179329
- Parent:
- 6:8d80c84e0c09
- Child:
- 8:8d30ce9a9463
--- a/main.cpp Thu Jul 16 08:38:19 2015 +0000 +++ b/main.cpp Fri Jul 17 07:11:46 2015 +0000 @@ -234,17 +234,17 @@ } */ - while(1) { - //calibration - pc.printf("Welcome to DOGWHEELSCHAIR\n"); - pc.printf("Calibration [START]\n"); - calibration(1); - calibration(2); - calibration(3); - calibration(4); - pc.printf("Calibration [FINISH]\n"); - pc.printf("RUN mode [START]\n"); - } + while(1) { + //calibration + pc.printf("Welcome to DOGWHEELSCHAIR\n"); + pc.printf("Calibration [START]\n"); + calibration(1); + calibration(2); + calibration(3); + calibration(4); + pc.printf("Calibration [FINISH]\n"); + pc.printf("RUN mode [START]\n"); + } Update_command.attach(&getCommand,TIMER_UPDATE); @@ -526,9 +526,9 @@ case 2: pc.printf("motor[2] run up\n"); - do{ + do { motor_set(id,1); - }while(sw_LL_U==0) ; + } while(sw_LL_U==0) ; motor_stop(id); wait_ms(500); pc.printf("motor[2] stop up\n"); @@ -540,9 +540,9 @@ max_pos_LL = position_LL.read_u16(); pc.printf("max_pos_LL= %d\n",max_pos_LL); pc.printf("motor[2] run down\n"); - do{ + do { motor_set(id,2); - }while(sw_LL_D==0) ; + } while(sw_LL_D==0) ; motor_stop(id); wait_ms(500); pc.printf("motor[2] stop down\n"); @@ -560,14 +560,13 @@ pc.printf("motor[3] run up\n"); do { motor_set(id,1); - }while(sw_RU_U==0); + } while(sw_RU_U==0); motor_stop(id); wait_ms(500); pc.printf("motor[3] stop up\n"); do { motor_set(id,2); - } while(sw_RU_U); motor_stop(id); wait_ms(500); @@ -576,20 +575,13 @@ pc.printf("motor[3] run down\n"); - /*while(count >1) { + do { motor_set(id,2); - if(sw_RU_D) - { - count--; - } - }*/ - do { - - motor_set(id,2); - }while(sw_RU_D==0); + } while(sw_RU_D==0); motor_stop(id); wait_ms(500); pc.printf("motor[3] stop down\n"); + do { motor_set(id,1); } while(sw_RU_D); @@ -604,7 +596,7 @@ pc.printf("motor[4] run up\n"); do { motor_set(id,1); - }while(sw_RL_U==0); + } while(sw_RL_U==0); motor_stop(id); wait_ms(500); pc.printf("motor[4] stop up\n"); @@ -616,9 +608,9 @@ max_pos_RL = position_RL.read_u16(); pc.printf("max_pos_RL= %d\n",max_pos_RL); pc.printf("motor[4] run down\n"); - do{ + do { motor_set(id,2); - }while(sw_RL_D==0); + } while(sw_RL_D==0); motor_stop(id); wait_ms(500); pc.printf("motor[4] stop down\n"); @@ -657,7 +649,7 @@ uint8_t status = pan_a.receiveCommunicatePacket(&packet); myled=0; - + if(status == ANDANTE_ERRBIT_NONE) { @@ -665,7 +657,7 @@ count--; } else { count=0; - + } pan_a.sendCommunicatePacket(&packet); //update command @@ -679,6 +671,6 @@ //stop robot count++; myled=1; - // setSpeedControl(0.0); + // setSpeedControl(0.0); } } \ No newline at end of file