m b
/
ACS712HelloWorldDemo
Demo of the ACS712 Library
Fork of ece4180_lab4_ACS712 by
Diff: ACS712.h
- Revision:
- 1:4f9effb20c29
- Parent:
- 0:a35011a2fdaa
- Child:
- 2:2b5233355986
--- a/ACS712.h Wed Mar 09 04:19:10 2016 +0000 +++ b/ACS712.h Sun Mar 13 16:43:23 2016 +0000 @@ -7,16 +7,11 @@ float read(); float operator=(ACS712&); - //void sampleInterval(float); - //void sampleFrequency(float); - //void bufferLength(int); - //float[] readBuffer(); + operator float() { return read(); } private: AnalogIn sensor; float translate(float); - //float[] circularBuffer; - //float interval; float ratio; short type; @@ -47,10 +42,12 @@ float ACS712::read(){ - return ACS712::translate(sensor); + return ACS712::translate(sensor * 3.3); } -float ACS712::operator=(ACS712& rhs){ - return rhs.read(); +ACS712& ACS712::operator=(ACS712& rhs){ + sensor = rhs.sensor; + ratio = rhs.ratio; + type = rhs.type; + return this; } -