Relay Preserve State Sample
This sample demonstrates state preserve functionality of the Relay HAT.
To run the sample:
Download the sample code from https://github.com/Turta-io/RelayHAT2/blob/master/Samples/Python/Relay_Preserve_State.py
Copy the sample code to a folder on the Raspberry Pi.
Open terminal, and then go to the folder you copied the sample.
Run the sample with the following command:
Sample Code
Relay_Preserve_State.py
Result
When you run the sample, the relay states are changed every two seconds. The example output should be like this:
To stop the Python script, just press CTRL + C.
Last updated