the program have one sensor acs712 and moduleds1302
Dependencies: FATFileSystem mbed
ACS712 Class Reference
A Hall-Effect sensor for measuring current levels in a given path. More...
#include <ACS712.h>
Public Member Functions | |
ACS712 (PinName _pin, float voltDivRatio=1, short type=5) | |
Create a hall-effect sensor of the specified type. | |
float | read () |
Read the value of the measured current in amps. | |
operator float () | |
Read the value of the measured current in amps Allows the ACS712 object to be used in a float context. |
Detailed Description
A Hall-Effect sensor for measuring current levels in a given path.
Can be used as a current detector
Example:
// Periodically read current levels in a circuit and // send output to PC terminal #include "mbed.h" #include "ACS712.h" // Connect the sensor analog output pin to mbed's AnalogIn pin ACS712 dev(p18); // Connect mbed to pc's USB port Serial pc(USBTX, USBRX); int main() { pc.printf("Sensor Log: \n\n\r"); while (1) { // Read current from sensor and output to pc terminal pc.printf("Sensor Value: %2.2f A\n\r", dev); wait(0.200); } }
Definition at line 30 of file ACS712.h.
Constructor & Destructor Documentation
ACS712 | ( | PinName | _pin, |
float | voltDivRatio = 1 , |
||
short | type = 5 |
||
) |
Create a hall-effect sensor of the specified type.
- Parameters:
-
_pin mbed AnalogIn pin where the analog output of sensor is connected voltDivRatio resistor voltage division ratio at output of the sensor type type of ACS712 sensor used
- Note:
- Supported types of sensors:
Member Function Documentation
operator float | ( | ) |
Generated on Wed Jul 13 2022 05:59:47 by 1.7.2