The following Python script will be executed when instructed in our Garden_Irrigation1 file that we created in Section 6.
As I want to be alerted - 1) when the irrigation pump starts and - 2) when the pump stops we need to create two instances of the file;
pump_started.py
pump_stopped.py
Be sure to save these files in the same location that you previously saved Garden_Irrigation1.py
and again change the file permissions to 755
$ chmod 755 pump_started.py
As we will be calling the above from within another Python script .... lets simulate this in Python's Interactive Mode
type : >>> execfile('pump_started.py')
OK - lets see this in action
In the next section I will return to the Raspberry Pi and Piface to start looking at outputs and incorporating the above into the Garden_Irrigation script