Relay LED Control Sample
This sample demonstrates turning relay indicator LEDs on and off.
To run the sample:
Download the sample code from https://github.com/Turta-io/RelayHAT2/blob/master/Samples/Python/Relay_LED_Control.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_LED_Control.py
Result
When you run the sample, the relays invert their states sequentially. Then, it turns off all indicator LEDs, while relays are on. Then, the sample code turns indicator LEDs on and turns off all the relays. The example output should be like this:
To stop the Python script, just press CTRL + C.
Last updated