December 18, 2023, 04:46
python import RPi.GPIO as GPIO import serial import time from Library import PiTalk_4G gps = PiTalk_4G.eg25().gps_positioning()And if you take a look in the PiTalk_4G library you will find:
python ser = serial.Serial('/dev/ttyS0',115200)And the section def gps_positioning(self): will show you the AT commands for retreiving the location.
def gps_positioning(self): #This function is used for get gps positioning self.power_on(power_key) rec_null = True self.answer = 0 print('Starting GPS session...') rec_buff = '' self.send_at('AT+CGPS=1,1','OK',1) time.sleep(2) while rec_null: answer = self.send_at('AT+CGPSINFO','+CGPSINFO: ',1) if 1 == self.answer: self.answer = 0 if ',,,,,,' in rec_buff: print('GPS is not ready') rec_null = False time.sleep(1) else: print('error %d'%self.answer) rec_buff = '' self.send_at('AT+CGPS=0','OK',1) return False time.sleep(1.5)