FUSION AUTOMATE
Published © GPL3+

Use Python to Place a Calls from A9G(GSM/GPRS + GPS) Module

How to use Python to Place a Calls from A9G(GSM/GPRS + GPS) Module

IntermediateProtip1 hour44
Use Python to Place a Calls from A9G(GSM/GPRS + GPS) Module

Story

Read more

Schematics

connection diagram

Code

make_call.py

Python
import serial
import time

def send_command(command):
    ser.write((command + '\r\n').encode())
    time.sleep(1)
    response = ser.read(ser.inWaiting()).decode()
    return response

def make_call(phone_number):
    send_command('ATD{}'.format(phone_number))  # Dial the phone number

if __name__ == "__main__":
    # Open serial connection to the A9G module
    ser = serial.Serial('COMX', 115200, timeout=1)

    # Wait for the module to initialize
    time.sleep(2)

    # Make a call
    phone_number = input("Enter phone number (e.g. +91XXXXXXXXXX): ")
    # phone_number = "+91XXXXXXXXXX"

    make_call(phone_number)

    # Close serial connection
    ser.close()

Credits

FUSION AUTOMATE

FUSION AUTOMATE

25 projects • 1 follower

Comments