while True: if uart.any() > 0: data = uart.read() print(data) if "on" in data: led.value(1) print('LED on \n') uart.write('LED on \n') elif "off" in data: led.value(0) print('LED off \n') uart.write('LED off \n')
2
Get GPS Data (Python Script)
from machine import Pin, UART, I2C from ssd1306 import SSD1306_I2C
def getGPS(gpsModule): global FIX_STATUS, TIMEOUT, latitude, longitude, satellites, GPStime
timeout = time.time() + 8 while True: gpsModule.readline() buff = str(gpsModule.readline()) parts = buff.split(',')
if (parts[0] == "b'$GPGGA" and len(parts) == 15): if(parts[1] and parts[2] and parts[3] and parts[4] and parts[5] and parts[6] and parts[7]): print(buff)
latitude = convertToDegree(parts[2]) if (parts[3] == 'S'): latitude = -latitude longitude = convertToDegree(parts[4]) if (parts[5] == 'W'): longitude = -longitude satellites = parts[7] GPStime = parts[1][0:2] + ":" + parts[1][2:4] + ":" + parts[1][4:6] FIX_STATUS = True break
if (time.time() > timeout): TIMEOUT = True break utime.sleep_ms(500)
is possible turn off gps or setup nice place, for example paris when i use drone in other place?
look at ukraine , people install here 'facke gps' because softweare send destination operator and drone to internet