Skip to content

Instantly share code, notes, and snippets.

@g0053
Forked from lidio601/bluetooth_sendsms.py
Created December 23, 2019 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g0053/840db7b00a494943c45fcbed06d3fed6 to your computer and use it in GitHub Desktop.
Save g0053/840db7b00a494943c45fcbed06d3fed6 to your computer and use it in GitHub Desktop.
Python test to send SMS to a phone via Bluetooth
import bluetooth
#import serial
sockfd = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
# sockfd.connect(('00:15:2A:D1:F4:8A', 1)) # BT Address
sockfd.connect(('00:1B:EE:35:0A:B1', 1)) # BT Address
sockfd.send('ATZ\r')
sockfd.send('AT+CMGF=1\r')
sockfd.send('AT+CMGS="+390111001101"\r') # TO PhoneNumber
sockfd.send('SMS over Bluetooth\n')
sockfd.send(chr(26)) # CTRL+Z
sockfd.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment