1. Detect button press (button connected to GPIO pin no 7 of RPI)
2. If button is pressed,
2.1 Glow LED connected to GPIO pin no 8 of RPI
2.2 Send a mail about the number of times the button is pressed
The python script pertaining to the implementation is in Fig 1 of slideshow below. The fields that are hidden are to be filled by your e mail id and password from which e mail id you would like to trigger the mail.
The field hidden in the bottom of the code is the destination mail id to which you want to send the mail.
Save the script as <your filename>.py and note the location where you have saved it.
Open terminal and execute the python script as in Fig 2.
When the button is pressed, the LED glows as in Fig 4.
The corresponding response is as in Fig 3.
You should also get a mail at the destination mail id..!
Making the script an executable one, so that you can run it by double clicking:-
1. Navigate to the location where the script is saved
2. Change the permission by using the command chmod +x <your file name>.py
3. Now double clicking the script file should run the script.
Making the script run on startup:-
1. Open terminal and type sudo crontab -e
2. In the last line, enter this statement @restart python /home/pi/Desktop <your filename>.py &
3. Press ctrl+x to save and exit. When asked to confirm, enter 'y' and then hit enter again.
Restart RPI and see that the script runs on start up.