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.
AnalogInBaseClass.cpp
00001 #include "AnalogInBaseClass.h" 00002 #include "mbed.h" 00003 00004 AnalogInBaseClass::AnalogInBaseClass(PinName pin) : _pin(pin) { 00005 } 00006 float AnalogInBaseClass::read(void){ 00007 00008 int count = 20; 00009 00010 float meas = 0; 00011 float measAll = 0; 00012 for(int i = 0; i < count; i++){ 00013 meas = _pin.read(); // Converts and read the analog input value (value from 0.0 to 1.0) 00014 meas = meas * 3300; // Change the value to be in the 0 to 3300 range 00015 measAll+= meas; 00016 } 00017 return measAll/count; 00018 }
Generated on Tue Jul 26 2022 13:41:11 by
1.7.2