磁気式ケイデンス計の電圧をanalogPinで読みます。INA226で電池電圧も読みます。

Dependencies:   INA226_ver1 mbed

Files at this revision

API Documentation at this revision

Comitter:
tsumagari
Date:
Fri Jun 09 09:10:28 2017 +0000
Commit message:
?????????????analogPin??????INA226???????????

Changed in this revision

INA226.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
diff -r 000000000000 -r 9e7b96a82406 INA226.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/INA226.lib	Fri Jun 09 09:10:28 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/albatross/code/INA226_ver1/#e490f37579a6
diff -r 000000000000 -r 9e7b96a82406 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 09 09:10:28 2017 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "INA226.hpp"
+
+DigitalOut myled(LED1);
+
+I2C i2c(p9,p10);
+INA226 VCmonitor(i2c,0x9C);
+AnalogIn mgPin(p20);
+
+int main() {
+    unsigned short val;
+    double V;
+    val = 0;
+    if(VCmonitor.rawRead(0x00,&val) != 0){
+        printf("VCmonitor READ ERROR\n");
+        while(1){}
+    }
+    VCmonitor.setCurrentCalibration();
+    
+    while(1) {
+        if(VCmonitor.getVoltage(&V) == 0){
+            printf("e:%f\n",V);
+        }
+        printf("mgPin V:%f\n\r",mgPin.read()*3.3);
+        wait(0.1);
+    }
+}
diff -r 000000000000 -r 9e7b96a82406 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jun 09 09:10:28 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file