How do you send AT GSM commands using python?

前端 未结 2 1481
醉话见心
醉话见心 2021-02-03 12:42

How do i send AT GSM commands using python?

Am able to do this quite easily using Delphi and some comport component (TComport), but how do i talk to my modem using pytho

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 13:27

    I do it like this with pyserial:

    import serial
    
    serialPort = serial.Serial(port=1,baudrate=115200,timeout=0,rtscts=0,xonxoff=0)
    def sendatcmd(cmd):
        serialPort.write('at'+cmd+'\r')
    
    print 'Loading profile...',
    sendatcmd('+npsda=0,2')
    

    Then I listen for an answer...

提交回复
热议问题