Relay Controller
This documentation includes installation guidelines and sample code for your hardware.
Windows 10 IoT Core Library
RelayController library is responsible for controlling the solid state relays.
To use the library, add the following using statement to the top of your C# code.
Then, create an instance of the RelayController class.
Now you're ready to access the library by calling the relayController instance.
Initialization
RelayController
Initiates the solid state relays.
Parameters
None
Basic Members
Set Relay
Controls the relay state.
Parameters
Int ch: Relay channel. 1 or 2.
Bool st: Relay state. True for enable, false for disable.
Returns
None
Read Relay State
Reads the relay state.
Parameters
Int ch: Relay channel. 1 or 2.
Returns
Bool: Relay state. True if relay is on, false if relay is off.
Disposal
To clean up the resources used by the class, call the Dispose() method it when the application is closing.
This method cleans the resources used by the class.
Samples
You can copy the example code from https://github.com/Turta-io/IoTHAT/tree/master/Samples/Windows10IoTCore address. There is one example of this library.
Relay Controller Sample App
This application demonstrates turning relays on and off.
To run the example:
Open the sample project you downloaded.
Make sure "ARM" is selected from the solution platforms selection.
Deploy the sample to the Raspberry Pi using the "F5" key.
Sample Code
Result
When you run the sample, it turns on and off the relays repeatedly.
To stop the application, use the "Stop" button on the Visual Studio.
Last updated