UTHM idp team 120
Dependencies: ESP8266 Servo TextLCD mbed
Fork of ACS712HelloWorldDemo by
Diff: main.cpp
- Revision:
- 1:4f9effb20c29
- Parent:
- 0:a35011a2fdaa
- Child:
- 5:a022ca4aaa1e
diff -r a35011a2fdaa -r 4f9effb20c29 main.cpp --- a/main.cpp Wed Mar 09 04:19:10 2016 +0000 +++ b/main.cpp Sun Mar 13 16:43:23 2016 +0000 @@ -1,7 +1,18 @@ #include <mbed.h> #include "ACS712.h" -int main(){ +int main() +{ + // Connect the sensor analog output pin to mbed's AnalogIn pin ACS712 dev(p18); - - } \ No newline at end of file + // 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", dev); + wait(0.200); + } + +} \ No newline at end of file