Photocoupler Input
This documentation includes installation guidelines and sample code for your hardware.
Windows 10 IoT Core Library
PhotocouplerInput library is responsible for reading isolated inputs from the photocouplers.
To use the library, add the following using statement to the top of your C# code.
Then, create an instance of the PhotocouplerInput class.
Now you're ready to access the library by calling the photocouplerInput instance.
Initialization
PhotocouplerInput
Initiates the LTV-827S photocouplers to detect isolated 5V input.
Parameters
Int debounceTimeout: Debounce timeout in milliseconds to eliminate the contact flickering. 0 to disable the filter.
Basic Members
Read Input State
Reads current input state.
Parameters
Int ch: Photocoupler input channel. 1, 2, 3 or 4.
Returns
Bool: True if input is high. False if input is low.
Interrupts
Photocoupler Input Changed
Notifies on photocoupler input change.
Event Args
Int Ch: Photocoupler input channel. 1, 2, 3 or 4.
Bool State: Input state. True if input is high. False if input is low.
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.
Photocoupler Sample App
This application demonstrates reading isolated inputs from photocoupler input channels.
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 prints the photocoupler input state changes to the Visual Studio Output / Immediate Window.
To stop the application, use the "Stop" button on the Visual Studio.
Last updated