FSR
Dependents: FSR_hello_world FINAL_PROJECT Pousse_seringue_Ulg 0__Pousse_seringue ... more
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 Tue Jul 12 2022 11:35:09 by 1.7.2