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.
FSR Class Reference
Force sensitive resistor class using an AnalogIn pin. More...
#include <FSR.h>
Public Member Functions | |
| FSR (PinName Pin, float resistance) | |
| Create an FSR object. | |
| float | readRaw () |
| Read the raw data. | |
| float | readFSRResistance () |
| Read the resistance of the FSR. | |
| float | readWeight () |
| Read the weight in N. | |
Detailed Description
Force sensitive resistor class using an AnalogIn pin.
Example:
#include "mbed.h" #include "FSR.h" FSR fsr(p20, 10); // Pin 20 is used as the AnalogIn pin and a 10k resistor is used as a voltage divider int main(){ while (1) { printf("The raw data is %f\n", fsr.readRaw()); printf("The resistance of the FSR is %f\n", fsr.readFSRResistance()); printf("The weight on the FSR is %f\n\n", fsr.readWeight()); wait(0.3); //just here to slow down the output for easier reading } }
Definition at line 25 of file FSR.h.
Constructor & Destructor Documentation
| FSR | ( | PinName | Pin, |
| float | resistance | ||
| ) |
Member Function Documentation
| float readFSRResistance | ( | ) |
| float readRaw | ( | ) |
Generated on Wed Jul 20 2022 21:37:27 by
1.7.2