Code for connecting led through two pin push button switch

I have used the push button switch in the hardware connection of controlling led. I connected one pin of push button to 5V and another pin to the gpio pin with the mentioned hardware connection of controlling led of the training program and it is working properly.
But I have to write a python code for that output so that if anyone turn on the light by the push button switch only , it gives a message .
I don’t how to take data from the push button pins. Can you please tell me the code for that??


@madhu8dec, so I’ve attached a code i tired using the digitalRead() function… The program basically monitors the switch every 5 seconds… and returns 1 as well as prints “Someone switched on the light”, when the button is pressed.
I’ve also sent a screenshot of the output…
I didn’t connect it Twilio and check,… but that should be pretty doable…
I hope I’ve been able to help you… output

hey @jmaryp.1999
thanks for your response.
This will also work and send the message in case I control the on / off of led from the bolt cloud as it takes the response from the digital pin. The digital pin is also high when I click on button on the bolt cloud.I want the message only in case when the switch is pressed not in the case when i turn on the led with the bolt cloud.