# Enable Serial Communication port = serial.Serial("/dev/ttyAMA0", baudrate=19200, timeout=1) # Transmitting AT Commands to the Modem # '\r\n' indicates the Enter key print "Sending Text..." print "Set the shield to SMS mode" port.write('AT+CMGF=1\r') print "Phone number" port.write('AT+CMGS = \"00905543588688\"') print "Message itself is sending" port.write('How are you today?') print "ctrl+z is sending" port.write(str(unichr(26))) print "text is sent" rcv = port.read(10) print rcv