def LongtransmitPhoto(sendimgName = ""): global t_start photo = "" IM920.Send("G" + str(nLat) + " " + str(nLon)) IM920.Send("G" + str(nLat) + " " + str(nLon)) IM920.Send("G" + str(nLat) + " " + str(nLon)) if sendimgName == "": IM920.Strt("2") #distancemode! time.sleep(1) Motor.motor(15, 15, 0.9) Motor.motor(0, 0, 1) takePhoto() print("Send Photo") sendPhoto.sendPhoto(photoName) print("Send Photo Finished") Other.saveLog(sendPhotoLog, time.time() - t_start, GPS.readGPS(), photoName) IM920.Strt("2") #distancemode time.sleep(1) else: # 1st time transmit print("airphoto") IM920.Strt("2") #distancemode! time.sleep(1) Motor.motor(15, 15, 0.9) Motor.motor(0, 0, 1) print("Send Photo") sendPhoto.sendPhoto(sendimgName) print("Send Photo Finished") Other.saveLog(sendPhotoLog, time.time() - t_start, GPS.readGPS(), sendimgName) IM920.Strt("2") #distancemode time.sleep(1) IM920.Send("G" + str(nLat) + " " + str(nLon)) IM920.Send("G" + str(nLat) + " " + str(nLon)) IM920.Send("G" + str(nLat) + " " + str(nLon))
def setup(): global phaseChk global startPosStatus pi.set_mode(17,pigpio.OUTPUT) pi.set_mode(22,pigpio.OUTPUT) pi.write(22,1) #IM920 Turn On IM920.Strt("2") #distance mode pi.write(17,0) #Outcasing Turn Off time.sleep(1) BME280.bme280_setup() BME280.bme280_calib_param() BMX055.bmx055_setup() TSL2561.tsl2561_setup() GPS.openGPS() with open(phaseLog, 'a') as f: pass #if it is End to End Test, then try: phaseChk = int(Other.phaseCheck(phaseLog)) except: phaseChk = 0 #if it is debug #phaseChk = 8 if phaseChk == 0: Other.saveLog(positionLog, "Goal", gLat, gLon, "\t") startPosStatus = 1 else: Other.saveLog(positionLog, "\t") if(Other.positionCheck(positionLog) == [0.0, 0.0]): print("Not Logged Start Position") startPosStatus = 1 else: rsLat, rsLon = Other.positionCheck(positionLog) print(rsLat, rsLon) startPosStatus = 0
import IM920 if __name__ == "__main__": args = sys.argv if (args[1] == "RDCH"): data = IM920.Rdch() elif (args[1] == "STCH"): data = IM920.Stch(args[2]) elif (args[1] == "ENWR"): data = IM920.Enwr() elif (args[1] == "RDID"): data = IM920.Rdid() #elif(args[1] == "SBRT"): # data = IM920.Sbrt(args[2]) elif (args[1] == "RDRT"): data = IM920.Rdrt() elif (args[1] == "SRID"): data = IM920.Srid(args[2]) elif (args[1] == "RRID"): data = IM920.Rrid() elif (args[1] == "STRT"): data = IM920.Strt(args[2]) elif (args[1] == "RDRT"): data = IM920.Rdrt(args[2]) elif (args[1] == "RPRM"): data = IM920.Rprm() else: data = "None" print(data)
while (sendStatus != b'OK\r\n'): if (time.time() - t_send > 3): break else: time.sleep(0.01) sendStatus = IM920.Send(str(num)) #print("Send") count = count + 1 print(num) print(count) time.sleep(0.1) IM920.Send("MF") time.sleep(0.1) IM920.Send("MF") time.sleep(0.1) IM920.Send("MF") print(time.time() - t) print("Finish") returnVal = 1 else: print("File Not Found") returnVal = 0 return returnVal if __name__ == "__main__": IM920.Strt("1") photoName = "sendPhoto.jpg" sendPhotoStatus = sendPhoto(photoName) print(sendPhotoStatus)
if __name__ == "__main__": try: pi.write(22, 1) GPS.openGPS() BME280.bme280_setup() BME280.bme280_calib_param() BMX055.bmx055_setup() TSL2561.tsl2561_setup() for i in range(10): gpsData = GPS.readGPS() luxData = TSL2561.readLux() bmeData = BME280.bme280_read() bmxData = BMX055.bmx055_read() photo = Capture.Capture("photo/photo") IM920.Strt("1") com1Data = IM920.Send("P" + str(1)) IM920.Strt("2") com2Data = IM920.Send("P" + str(2)) print("GPS\t\t", gpsData) print("TSL2561\t\t", luxData) print("BME280\t\t", bmeData) print("BMX055\t\t", bmxData) print("photo\t\t", photo) print("fast mode\t", com1Data) print("distance mode\t", com2Data) print("\n\n") """ for j in range(1): pi.write(22, 1) GPS.openGPS()
def beacon(): IM920.Strt("1") #fastmode convert IM920.Send("B") IM920.Strt("2") # distancemode