How do you send AT GSM commands using python?

前端 未结 2 1478
醉话见心
醉话见心 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:10

    I don't know if there is an AT module, but you can use pyserial to communicate with a serial port.

    0 讨论(0)
  • 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...

    0 讨论(0)
提交回复
热议问题