Demo of the ACS712 Library

Dependencies:   Servo mbed

Fork of ece4180_lab4_ACS712 by Gedeon Nyengele

main.cpp

Committer:
mikeb
Date:
2016-03-14
Revision:
6:37921526d00d
Parent:
5:a022ca4aaa1e

File content as of revision 6:37921526d00d:

#include <mbed.h>
#include "ACS712.h"

int main()
{
    // 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);
    
    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", float(dev));
        wait(1);
    }

}