python操作串口的库 pyserial
因为考虑到跨平台,可能要布署在linux,再结合开发的容易度,最终认为python在这方面有一定的优势
做短信收发主要是用于:
1,用户快速注册
2,用户绑定手机
3,密码安全
4,重要通知(短信群发)
Short introduction
Open port 0 at "9600,8,N,1", no timeout
>>> import serial>>> ser = serial.Serial(0) #open first serial port>>> print ser.portstr #check which port was really used>>> ser.write("hello") #write a string>>> ser.close() #close port
Open named port at "19200,8,N,1", 1s timeout
>>> ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)>>> x = ser.read() #read one byte>>> s = ser.read(10) #read up to ten bytes (timeout)>>> line = ser.readline() #read a '\n' terminated line>>> ser.close()