Home Page Forums Raspberry Pi Shields Send SMS from GPRS shield Reply To: Send SMS from GPRS shield

#1596

leslieubeda
Participant

Start GPRS mudule at boot using Python

Make sure the module is off

from terminal:
1. create a startgprs.py file (touch startgprs.py)
2. copy the following code on it:

import RPi.GPIO as GPIO ## Import GPIO Library
import time ## Import ‘time’ library. Allows us to use ‘sleep’

GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
GPIO.setup(22, GPIO.OUT) ## Setup GPIO pin 7 to OUT

GPIO.output(22, True) ## Turn on GPIO pin 7
time.sleep(2) ## Wait
GPIO.output(22, False) ## Switch off GPIO pin 7
GPIO.cleanup()

3. makes it executable (chmod +x startgprs.py)

4. try it! (python startgprs.py). The blue led start to flash

5. Create auto boot (sudo crontab -e) and the add the end; @reboot python /home/pi/startgprs.py &

That’s it!