Lab 4
Fork of ACS712 by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include <mbed.h> 00002 #include "ACS712.h" 00003 00004 int main() 00005 { 00006 // Connect the sensor analog output pin to mbed's AnalogIn pin 00007 ACS712 dev(p18); 00008 // Connect mbed to pc's USB port 00009 Serial pc(USBTX, USBRX); 00010 00011 pc.printf("Sensor Log: \n\n\r"); 00012 00013 while (1) { 00014 // Read current from sensor and output to pc terminal 00015 pc.printf("Sensor Value: %2.2f A\n\r", float(dev)); 00016 wait(1); 00017 } 00018 00019 }
Generated on Tue Aug 2 2022 11:49:48 by
1.7.2
