スマートコンセント(富士通 FX-5204PS)をIEEE1888 StorageにWRITEするサンプルプログラムです。

Dependencies:   EthernetInterface FiapV2 HTTPClientForSOAP NTPClient TextLCD mbed-rtos mbed spxml

Fork of BlueUSB_f by Yasushi TAUCHI

スマートコンセント(富士通 FX-5204PS)をIEEE1888 StorageにWRITEするサンプルプログラムです。
USB HUBを使用して2台利用した例です。
表示のみは http://mbed.org/users/yueee_yt/code/BlueUSB_f/で公開しています。

BlueUSBより派生していますが、BluetoothとMass Storage Classは利用できません。

2台まで確認していますが、プログラム的には10台まで接続できるようにしています。
(RTOSとの整合により難しいかもしれません)

Revision:
2:32a2d06f4fe2
Parent:
1:3f2890d103fb
Child:
3:528f73ce625e
--- a/main.cpp	Wed Sep 26 06:29:47 2012 +0000
+++ b/main.cpp	Thu Sep 27 13:04:36 2012 +0000
@@ -24,6 +24,7 @@
 #include "USBHost.h"
 #include "Utils.h"
 #include "FATFileSystem.h"
+#include "TextLCD.h"
 
 int MassStorage_ReadCapacity(int device, u32* blockCount, u32* blockSize);
 int MassStorage_Read(int device, u32 blockAddr, u32 blockCount, u8* dst, u32 blockSize);
@@ -102,26 +103,42 @@
     pc.putc(c); // echo
     return c;
 }
-
-void TestShell();
 void InitUSPS();
 void USPS_Refresh();
 DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
 Timer t;
+Timer t2;
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+extern float WattData1[],WattData2[],WattData3[],WattData4[];
+extern int SerialNo[];
 int main()
 {
     pc.baud(460800);
-    printf("BlueUSB\nNow get a bunch of usb or bluetooth things and plug them in\n");
     InitUSPS();
-    //TestShell();
-     USBInit();
-     t.start();
-     while(1){
-     USBLoop();
- if(t>1 ){
- t.start();
- led1=!led1;
-USPS_Refresh();
- }    
-     }
+    USBInit();
+    t.start();
+    t2.start();
+    lcd.cls();
+    lcd.printf("Watting....");
+    while(1) {
+        USBLoop();
+        if(t>0.1 ) {
+            t.start();
+            led4=!led4;
+            USPS_Refresh();
+        }
+        if(t2>1){
+            t2.start();
+            if(SerialNo[0]==0)led1=0;else led1=1;
+            if(SerialNo[1]==0)led2=0;else led2=1;
+            if(SerialNo[2]==0)led3=0;else led3=1;
+            lcd.locate(0,0);
+            lcd.printf("1:%4.0fW  2:%4.0fW",WattData1[0],WattData2[0]);
+            lcd.locate(0,1);
+            lcd.printf("3:%4.0fW  4:%4.0fW",WattData3[0],WattData4[0]);
+        }
+    }
 }