Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Send SMS from USB 3G viettel using Raspberry PI
import serial
def send_text(number, text, path='/dev/ttyUSB1'):
ser = serial.Serial(path, timeout=1)
ser.write('AT+CMGF=%d\r' % 1)
ser.write('AT+CMGS="%s"\r' % number)
ser.write('%s\x1a' % text)
print ser.readlines()
send_text('098xxxxxx', 'hey how are you?')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment