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.
Dependents: 200319_ESCON_motor
ESCON_rpm.cpp
- Committer:
- dsfqfqds
- Date:
- 2020-03-23
- Revision:
- 0:bdb5e4c36d39
- Child:
- 1:664683c8423c
File content as of revision 0:bdb5e4c36d39:
/*
* @author Jinhyuk Yoon
*
* Designed to control ESCON via NUCELO-F767ZI
*/
#include "ESCON_rpm.h"
ESCON_rpm::ESCON_rpm(PinName rpm_in_pin, double min_volt_, double max_volt_, double min_rpm_, double max_rpm_) : rpm(rpm_in_pin) {
min_volt = min_volt_;
max_volt = max_volt_;
min_rpm = min_rpm_;
max_rpm = max_rpm_;
grad = (max_rpm - min_rpm) / (max_volt - min_volt);
}
double ESCON_rpm::read(void) {
return grad*(rpm*max_volt - min_volt) + min_rpm;
}