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: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_Practice1 by
headerfile_unuse/accelerator_.h
- Committer:
- echo_piyo
- Date:
- 2017-09-24
- Revision:
- 66:1664ee92539d
- Parent:
- accelerator.h@ 3:9ef929639c4a
File content as of revision 66:1664ee92539d:
class Accel
{
public :
void setup(float Acceleration, float time) {
a = Acceleration*time;
v = 0;
}
float duty(float target) {
if (fabs(target-v) <= a){
v = target;
} else if (v < target) {
v = v + a;
} else if (v > target) {
v = v - a;
}
return v;
}
private :
float a;
float v;
};
