embedded mulmeter

Dependencies:   INA219 SDFileSystem mbed

Fork of INA219-HelloWorld by Components

Files at this revision

API Documentation at this revision

Comitter:
melse
Date:
Thu Aug 28 10:39:58 2014 +0000
Child:
1:a39067e83bd8
Commit message:
Initial Commit

Changed in this revision

INA219.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/INA219.lib	Thu Aug 28 10:39:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/components/code/INA219/#eee9c8ba72ff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 28 10:39:58 2014 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "INA219.hpp"
+
+Serial pc(USBTX, USBRX);
+DigitalOut led1(p25);
+
+// Get this to work with the INA219 Breakout from Adafruit
+INA219 ina219(p28, p27, 0x40, 400000, RES_10BITS);
+
+Ticker measure;
+float refresh_rate = 1000;
+
+void show_current()
+{
+    float current_ma = ina219.read_current_mA();
+    pc.printf("%f\r\n", current_ma);
+    
+    led1 = !led1;
+}
+
+int main(void)
+{
+    pc.baud(921600);
+
+    float refresh_interval = 1/refresh_rate;
+    measure.attach(&show_current, refresh_interval);
+
+    while (1) {
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 28 10:39:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file