Ejemplo n.º 1
0
                             LOCATION, R)
            else:  #file name just with date
                f = initFile(datestart, RPI, FOLDER, LOCATION, R)
            ts = time.time()
            tnow = datetime.datetime.fromtimestamp(ts).strftime(
                '%Y-%m-%d %H:%M:%S')
            data = tnow

            if MODE == "GPS":  #IF GPS is attahced and turned on, get GPS data
                lat, lon, alt = Work()
                print("Lat:", lat, "Lon", lon)
                data = data + "," + str(lat) + "," + str(lon) + "," + str(alt)
            if V.DHTON == "ON":  #Get DHT data, for all DHT attached
                for DH, PIN in zip(V.DHTNAMES, V.DHTPINS):
                    HT = DHT()
                    RH, T = HT.getData(DH, PIN)
                    data = data + "," + str(RH) + "," + str(T)
            #run through each sensors reading there data
            if V.OPCON == "ON":
                for pro, r, p in zip(Sen, R, P):  #loop through OPC
                    newdata = pro.getData(p, r)
                    data = data + "," + newdata
                    if "spi error" in newdata.lower():
                        pro = sen(p, r)  #initiate the sensors
#restate senors in SPI error occres
                    if V.BLINKT == "ON":

                        clear()
                        set_pixel(0, 10, 10, 10)
                        set_pixel(1, 10, 10, 10)