#Program used to send message from Rasperry Pi with a button
from twilio.rest import Client
import os
import RPi.GPIO as GPIO
#import necessary packages such as GPIO
input_value = 1
#button will give input of 0 if pressed, 1 by default
buttonpin=6
#GPIO Pin connected to button
account_sid="youraccountsid"#put in your account sid
auth_token="youraccounttoken"#put in your account token
client = Client(account_sid, auth_token)
#Use your account sid and account token from twilio to send a message
GPIO.setmode(GPIO.BCM)
#Uses GPIO Pin numbering
GPIO.setup(buttonpin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#Setup Pin No.6 as an input pin and set pin to High as default.
while True:
input_value = GPIO.input(buttonpin)
if input_value == 0: #if button pressed
message = client.messages \
.create(
body ="You Pressed a Button", #message your sending
from_="+phone number given by twilio",#plug in phone no. given by twilio
to="+your phone no.")#to your phone number
break;
GPIO.cleanup()
#Pins go back to normal state
#DigitalMarketingCareer #DigitalMarketingjob #DigitalMarketingCourse #LearnDigitalMarketing
Learn Digital Marketing in Hindi & English Mix
• How To Optimize my Business on Google | D...