Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send SMS from USB 3G viettel using Raspberry PI https://sonnguyen.ws/send-sms-from-raspberry-pi-with-usb-3g/
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()
ser.close()
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