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: mbed
Diff: controls.cpp
- Revision:
- 10:4a825f818432
- Parent:
- 9:76e4808df4cb
--- a/controls.cpp Fri Dec 01 21:20:29 2017 +0000 +++ b/controls.cpp Thu Apr 05 21:21:51 2018 +0000 @@ -79,19 +79,19 @@ if(cycle_speed_M1>1) // Can't go over 1 as that is the max speed cycle_speed_M1=1; - if(cycle_speed_M1<0){ //Can't go under 0 either - // pc.printf("M1: %8.8f\n",cycle_speed_M1); + if(cycle_speed_M1<0) { //Can't go under 0 either + // pc.printf("M1: %8.8f\n",cycle_speed_M1); cycle_speed_M1=0; - } + } if(cycle_speed_M2>1) cycle_speed_M2=1; - if(cycle_speed_M2<0){ - //pc.printf("M2: %8.8f\n",cycle_speed_M2); + if(cycle_speed_M2<0) { + //pc.printf("M2: %8.8f\n",cycle_speed_M2); cycle_speed_M2=0; - } - - //pc.printf("m1: %8.8f\n",cycle_speed_M1); - //pc.printf("m2: %8.8f\n",cycle_speed_M2); + } + + //pc.printf("m1: %8.8f\n",cycle_speed_M1); + //pc.printf("m2: %8.8f\n",cycle_speed_M2); //adjusting delays based off PID_error corrections pulse_M1 = (pulse_cycle-pulse_cycle*(1-cycle_speed_M1)); period_M1 = (pulse_cycle-pulse_cycle*cycle_speed_M1); @@ -101,7 +101,7 @@ period_M2 = (pulse_cycle-pulse_cycle*cycle_speed_M2); //pc.printf("pulse2: %8.8f\n", pulse_M1); - // pc.printf("period2: %8.8f\n", period_M1); + // pc.printf("period2: %8.8f\n", period_M1); //controlling the speed for motor 1 if(High_M1) { High_M1=pulse_M1 > T_M1.read_ms(); @@ -133,7 +133,7 @@ T_M2.reset(); } } - + } T.stop(); T_M1.stop();