/********************************************************************* 本ソースリストおよびソフトウェアは、ライセンスフリーです。 利用、編集、再配布等が自由に行えますが、著作権表示の改変は禁止します。 ※注意:パソコンやファンヒータなどAC電源の途絶えると故障や事故の発生する 機器をSmart Plugに接続しないこと。 ※このソースはPC用です。■■■H8では動作しません■■■ Copyright (c) 2010-2012 Wataru KUNINO https://bokunimo.net/bokunimowakaru/ *********************************************************************/ //#define ERRLOG //ERRLOGをdefineするとエラーログが出力されます。 #define CTSENSER_MLTPL 1.17302 / 0.3536 // 負荷抵抗100Ω 最大3kW /* #define CTSENSER_MLTPL 1.17302 / 3.536 // 負荷抵抗1kΩ 最大300W #define CTSENSER_MLTPL 1.17302 / 1.167 // 負荷抵抗330Ω 最大900W #define CTSENSER_MLTPL 1.17302 / 0.3536 // 負荷抵抗100Ω 最大3kW */ #include "../libs/lcd_pc.c" #include "../libs/xbee.c" #include "../libs/kbhit.c" #include "../libs/hex2a.c" #include "../libs/compress_csv.c" float ct_watts =-1; float ct_temp =-1; float ct_lux =-1; float aircon_watts =-1; float aircon_temp =-1; float aircon_lux =-1; float sens_press =-1; float sens_temp =-1; #define BER_GH_NUM 64 // 棒グラフの表示数 void html(){ FILE *fp_html; FILE *fp_ct; float graph[BER_GH_NUM]; int bar; byte i,j; int hh[BER_GH_NUM],mm[BER_GH_NUM]; int y,m,d; float dummy; if( (fp_html = fopen("htdocs/index.html", "w")) != NULL ){ fprintf(fp_html, "
屋外センサ | \r\n"); fprintf(fp_html, "気温 | \r\n%2.1f [℃] | \r\n",sens_temp); fprintf(fp_html, "
気圧 | \r\n%4.2f [hPa] | \r\n",sens_press); fprintf(fp_html, "|
電力メータ | \r\n"); fprintf(fp_html, "電力 | \r\n%4.0f [W]\r\n",ct_watts); if( ct_watts > 1000 ) bar = 100; else bar = (int)(ct_watts / 10 + 1); fprintf(fp_html, " |
気温 | \r\n%2.1f [℃] | \r\n",ct_temp); fprintf(fp_html, "|
照度 | \r\n%4.0f [lux] | \r\n",ct_lux); fprintf(fp_html, "|
エアコン | \r\n"); fprintf(fp_html, "電力 | \r\n%4.0f [W]",aircon_watts); if( aircon_watts > 1000 ) bar = 100; else bar = (int)(aircon_watts / 10 + 1); fprintf(fp_html, " |
気温 | \r\n%2.1f [℃] | \r\n",aircon_temp); fprintf(fp_html, "|
照度 | \r\n%4.0f [lux] | \r\n",aircon_lux); fprintf(fp_html, "