Home › Forums › Forums › Technical Support for BerryGPS and BerryGPS-IMU › Can the minicom settings be scripted › Reply To: Can the minicom settings be scripted
April 13, 2020 at 3:56 pm #15723
PeterP
Participant
you don’t need minicon to send the commands to the device.
Have a lookt at this page, at the bottom it has a some examples of using “echo” and Python
echo -e "AT+UPSDA=0,3" > /dev/ttyACM1
#!/usr/bin/env python
import serial, time
port = "/dev/ttyACM1"
PAUSE = 0.1
def sendCommand(command):
command = command + "\r\n"
ser.write(command)
#ser.flush()
output = ser.read_until() # default is \n
print "Command sent:", output.rstrip() #rstrip will remove any trailing new lines or carriage return, this makes the output more readable
response = ser.read_until()
#response = ser.read(80)
print "response", response
time.sleep(PAUSE)
ser = serial.Serial(port, baudrate = 115200, timeout = 0.2)
sendCommand("AT+UPSD=0,1,\"hologram\"") #Set APN
sendCommand("AT+UPSDA=0,3\r\n") #Activate connection to carrier
time.sleep(PAUSE+3) #Give the modem time to connect
sendCommand("AT+UGIND=1") #Activate the unsolicited aiding result
sendCommand("AT+UGPS=1,4,71") #Turn on GNSS with online assistance and use GPS+SBAS+GLONASS+Galileo
Peter --OzzMaker.com --
