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.
lcm101.h
00001 #ifndef _LCM101_H_ 00002 #define _LCM101_H_ 00003 00004 #include "mbed.h" 00005 00006 /** 00007 * Simple class to read out an LCM101 S-beam force sensor connected to an analog 00008 * input. 00009 */ 00010 class Lcm101 { 00011 public: 00012 00013 /** 00014 * @param pin_a_in PinName of analog input 00015 * @param offset of analog value (calibration data) 00016 * @param factor multiplication factor for analog value (calibration data) 00017 */ 00018 Lcm101 (PinName pin_a_in, float offset, float factor) : 00019 analog_in_(pin_a_in), 00020 kOffset_(offset), 00021 kFactor_(factor) 00022 { 00023 } 00024 00025 /** 00026 * @return unscaled analog input value 00027 */ 00028 float getForceRaw () 00029 { 00030 return analog_in_.read(); 00031 } 00032 00033 /** 00034 * @return force value kOffset_ + kFactor_ * getForceRaw(); 00035 */ 00036 float getForce () 00037 { 00038 return kOffset_ + kFactor_ * getForceRaw (); 00039 } 00040 00041 /** 00042 * @return ffset of analog value 00043 */ 00044 float get_offset () { return kOffset_; } 00045 00046 /** 00047 * @return factor multiplication factor for analog value 00048 */ 00049 float get_factor () { return kFactor_; } 00050 00051 00052 private: 00053 AnalogIn analog_in_; 00054 00055 const float kOffset_; 00056 const float kFactor_; 00057 }; 00058 00059 #endif
Generated on Mon Aug 1 2022 05:08:24 by
1.7.2