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: LedController mbed-rtos mbed NerfUSXbee Servomotor TargetManager
Fork of NerfUS by
Diff: mbed_source/Calibrator.cpp
- Revision:
- 46:853966aab733
- Child:
- 49:4475f0760594
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_source/Calibrator.cpp Tue Apr 11 03:49:04 2017 +0000 @@ -0,0 +1,30 @@ +#include "Calibrator.hpp" +#include "mbed.h" + +Calibrator::Calibrator(Servomotor& servomotor): + servomotor(servomotor), + is_bumper_pressed(false) +{ +} + +void Calibrator::calibrate() +{ + float angle = 50; + + while(!is_bumper_pressed) + { + printf("Angle: %f\r\n", angle); + servomotor.set_angle(angle); + angle++; + wait_ms(25); + } + angle -= 3; + + servomotor.up_angle = angle; +} + +void Calibrator::on_rise() +{ + is_bumper_pressed = true; +} + \ No newline at end of file