with open(configfile, 'w') as configfile: conf.write(configfile) TotalPeriod = int(conf.get("period", "total_period")) SamplingPeriod = float(conf.get("period", "sampling")) ThingPeriod = float(conf.get("period", "thing_sampling")) ############# # # クラウド、DataBaseの設定 # #thingspeak # temp,humid,thermo_ave,themo_std,pressure fieldlist = ["field1", "field2", "field3", "field4", "field5"] thg = thingspeak.thingspeak("L0Z78PQTFYUWIER3") thg.set_field(fieldlist) #id は変更不可、それ以外を用途に合わせて編集 #idは自動で追加されます key = [("cnt", "int"), ("time", "text"), ("door", "int")] #key={"cnt":"int","time":"text","temp":"real","humid":"real","th_avez":"real","th_std":"real","pressure":"real","rawdata":"text"} print(conf.get("setting", "dbfile")) db = sql_lib.miyadb(conf.get("setting", "dbfile"), key) #dbの中身を削除するときは先に以下の命令を実行 db.clear() db.init_table2() #####################
db.clear() db.init_table2() ############# # # クラウド、DataBaseの設定 # #thingspeak # temp,humid,thermo_ave,themo_std,pressure # つかうセンサの数だけ並べる print("Initilize thingspeak") fieldlist=["field1","field2","field3"] thg=thingspeak.thingspeak(conf.get("thingspeak","APIKEY")) thg.set_field(fieldlist) ############# # # Sensor # # センサのオブジェクトを作成 print("Sensor initilize") #OMRON のセンサ sht=sht30.SHT30() #d6t = d6t_lib.GroveD6t("44L") psensor = omron_2smpd_lib.Grove2smpd02e()
conf.write(configfile) TotalPeriod=int( conf.get("period","totalperiod")) SamplingPeriod=float( conf.get("period","sampling")) SokuteiPeriod=float( conf.get("period","renzoku")) Thing_sampling=int( conf.get("period","thing_sampling")) ############# # # クラウド、DataBaseの設定 # #thingspeak fieldlist=["field7"] thg=thingspeak.thingspeak("VXI31K2ILAHWUOKS") thg.set_field(fieldlist) #id は変更不可、それ以外を用途に合わせて編集 #idは自動で追加されます key=[("cnt","int"),("time","text"),("current","real")] print(conf.get("setting","dbfile")) db=sql_lib.miyadb(conf.get("setting","dbfile"),key) #dbの中身を削除するときは先に以下の命令を実行 db.clear() db.init_table2() #####################