Skip to content

Instantly share code, notes, and snippets.

@mohammedhanine
Created September 28, 2014 16:57
Show Gist options
  • Save mohammedhanine/a60128c579d421cc2e2d to your computer and use it in GitHub Desktop.
Save mohammedhanine/a60128c579d421cc2e2d to your computer and use it in GitHub Desktop.
Remove Pin Python
#!/usr/bin/env python
"""\
pip install python-gsmmodem
"""
import logging
PORT = '/dev/ttyUSB1'
BAUDRATE = 115200
from gsmmodem.modem import GsmModem
def main(pin):
print('Initializing modem...')
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
modem = GsmModem(PORT, BAUDRATE)
modem.connect(pin)
if modem.write('AT+CPIN?')[0] == '+CPIN: READY':
modem.write('AT+CLCK="SC",0,"%s"' %pin)
modem.close()
if __name__ == '__main__':
pin = raw_input("type the pin: \n")
main(pin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment