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.
Fork of priustroller_2 by
throttle.cpp
00001 #include "includes.h" 00002 #include "sensors.h" 00003 #include "filters.h" 00004 00005 Throttle::Throttle(PinName pin, float min, float max) { 00006 _in = new AnalogVoltageSensor(pin, 1.0f); 00007 _min = min; 00008 _max = max; 00009 } 00010 00011 float Throttle::GetThrottle() { 00012 float v = _in->GetVoltage(); 00013 v = (v - _min) / (_max - _min); 00014 if (v > 1.0f) return 1.0f; 00015 if (v < 0.0f) return 0.0f; 00016 return v; 00017 }
Generated on Tue Jul 12 2022 18:31:15 by
