We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-05-14
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optocoupler
Downloaded: 4260 times
Not followed.
License: MIT license
Opto 2 click is an optical isolator used to provide an optical galvanic isolation of sensitive lines.
Do you want to subscribe in order to receive notifications regarding "OPTO 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "OPTO 2 click" changes.
Do you want to report abuse regarding "OPTO 2 click".
Library Description
The library performs the check procedure for the desired outputs (OUT1 - OUT4). For more details check the documentation.
Key functions:
Examples Description
The demo application is composed of three sections:
void applicationTask() { tmp = 1; for (cnt = 0; cnt < 4; cnt++) { switch (selOutput & tmp) { case 0x01 : { checkOutput = opto2_checkOut1(); if (checkOutput == 0) { mikrobus_logWrite( "OUT1 is low", _LOG_LINE ); } else { mikrobus_logWrite( "OUT1 is high", _LOG_LINE ); } break; } case 0x02 : { checkOutput = opto2_checkOut2(); if (checkOutput == 0) { mikrobus_logWrite( "OUT2 is low", _LOG_LINE ); } else { mikrobus_logWrite( "OUT2 is high", _LOG_LINE ); } break; } case 0x04 : { checkOutput = opto2_checkOut3(); if (checkOutput == 0) { mikrobus_logWrite( "OUT3 is low", _LOG_LINE ); } else { mikrobus_logWrite( "OUT3 is high", _LOG_LINE ); } break; } case 0x08 : { checkOutput = opto2_checkOut4(); if (checkOutput == 0) { mikrobus_logWrite( "OUT4 is low", _LOG_LINE ); } else { mikrobus_logWrite( "OUT4 is high", _LOG_LINE ); } break; } default : { break; } } tmp <<= 1; } mikrobus_logWrite( "", _LOG_LINE ); Delay_ms( 2000 ); }
mikroE Libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.