hvuhaushv;ov

Dependencies:   INA226_ver1 mbed

Fork of INA226TEST by Toshihisa T

Files at this revision

API Documentation at this revision

Comitter:
tsumagari
Date:
Sat May 27 09:05:59 2017 +0000
Parent:
2:86728e672228
Commit message:
2??ina226???????????????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 86728e672228 -r e37fd18c08e6 main.cpp
--- a/main.cpp	Fri Jan 15 17:04:51 2016 +0000
+++ b/main.cpp	Sat May 27 09:05:59 2017 +0000
@@ -8,8 +8,9 @@
 
 Serial debug(USBTX,USBRX);
 DigitalOut myled(LED1);
-I2C i2c(p28,p27);
-INA226 VCmonitor(i2c);
+I2C i2c(p9,p10);
+INA226 VCmonitor(i2c,0x9C);
+INA226 VCmonitor2(i2c,0x94);
 
 int main() {
     unsigned short val;
@@ -18,13 +19,15 @@
 
     debug.format(8,ParityNone,1);
     debug.baud(9600);
-    debug.printf("VCmonitor INA226 TEST Program. (BUILD:[" __DATE__ "/" __TIME__ "])\n");
-
-    if(!VCmonitor.isExist()){
-        debug.printf("VCmonitor NOT FOUND\n");
-        while(1){}
-    }
-    debug.printf("VCmonitor FOUND\n");
+    debug.printf("VCmonitor INA226 TEST Program. (BUILD:[" __DATE__ "/" __TIME__ "])\n\r");
+    
+//    int flag = VCmonitor.isExist();
+//    if(flag){
+//        debug.printf("VCmonitor FOUND\n");
+////        while(1){}
+//    }else{
+//        error("VCmonitor NOT FOUND\n");
+//    }
 
     val = 0;
     if(VCmonitor.rawRead(0x00,&val) != 0){
@@ -37,7 +40,10 @@
 
     while(1) {
         if((VCmonitor.getVoltage(&V) == 0) && (VCmonitor.getCurrent(&C) == 0)){
-            debug.printf("%d,V,%f,C,%f\n",count,V,C);
+            debug.printf("%d,V:%f,C:%f\n\r",count,V,C);
+        }
+        if((VCmonitor2.getVoltage(&V) == 0) && (VCmonitor2.getCurrent(&C) == 0)){
+            debug.printf("------------%d,V:%f,C:%f\n\r",count,V,C);
         }
         myled = 1;
         wait(0.5);