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:
- 8:45797dcd8b66
- Parent:
- 7:edd065946e9b
--- a/controls.cpp Wed Nov 22 06:58:41 2017 +0000 +++ b/controls.cpp Fri Dec 01 20:07:48 2017 +0000 @@ -1,4 +1,7 @@ #include "controls.h" +#include "controller.h" + +class controller; void dir_control_M1(controls dir) { @@ -47,7 +50,7 @@ const double pulse_cycle = 10; // ms -void move(double cycle_speed, int duration_ms, controls dir_M1, controls dir_M2, double (*PID_error)()) // cycle_speed from 0 - 1 +void move(double cycle_speed, *controller cntlr, controls dir_M1, controls dir_M2, double (*PID_error)()) // cycle_speed from 0 - 1 { Timer T; Timer T_M1; @@ -72,7 +75,7 @@ T_M1.start(); T_M2.start(); - while(T.read_ms()<(duration_ms)) { + while(counterM1 > cntlr->get_turn_cycles() || get_event() ) { cycle_speed_M1= cycle_speed - (*PID_error)(); //PID_error() should be under 1 most/all of the time ideally cycle_speed_M2= cycle_speed + (*PID_error)(); @@ -132,15 +135,5 @@ } -void sharp_right(int delay, int cycle_speed) -{ - move(cycle_speed, delay, forward, backward, PID); - move(cycle_speed, delay, forward, backward, PID); -} -void sharp_left(int delay) -{ - -} -