20 lines
485 B
Python
20 lines
485 B
Python
import argparse
|
|
import serial
|
|
import os
|
|
import time
|
|
|
|
argparser = argparse.ArgumentParser(description="Providing AT commands from command line parameters")
|
|
argparser.add_argument("--command", type=str, default="AT", help="command to be execute into SIM800L module")
|
|
|
|
command = argparser.parse_args().command
|
|
|
|
|
|
port = serial.Serial("/dev/serial0", baudrate=9600, timeout=1)
|
|
port.flush()
|
|
|
|
port.write(bytes(command+'\n','utf8'))
|
|
|
|
rcv = port.read(150)
|
|
|
|
print("received", rcv)
|
|
time.sleep(1)
|