first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import serial
|
||||
|
||||
serial_list=[]
|
||||
ser = serial.Serial("COM74", 115200, timeout=1)
|
||||
|
||||
|
||||
def changeToSMSMode():
|
||||
cmd = "AT+CMGF=1\r" # text mode
|
||||
sendCommand(cmd)
|
||||
msg = ser.read(64)
|
||||
print(msg)
|
||||
|
||||
|
||||
def sendCommand(cmd: str):
|
||||
print("send command {}".format(cmd))
|
||||
ser.write(cmd.encode())
|
||||
msg = ser.read(100)
|
||||
print(msg)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#enable verbose logs
|
||||
cmd = "AT+CMEE=2\r"
|
||||
sendCommand(cmd)
|
||||
#check pin
|
||||
cmd_check_pin = "AT+cpin?\r"
|
||||
sendCommand(cmd_check_pin)
|
||||
# cmd = "AT\r"
|
||||
# sendCommand(cmd)
|
||||
# msg = ser.read(64)
|
||||
# print(msg)
|
||||
# changeToSMSMode()
|
||||
|
||||
Reference in New Issue
Block a user