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: 2019-01-28
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: Pushbutton/Switches
Downloaded: 6530 times
Not followed.
License: MIT license
Tamper 2 click contains a levered D2HW-A221Dswitch by Omron, which outputs signal in both positions - pressed and released. The most common use of the Tamper 2 click is door opening or closing detection, detecting the end of travel of a linear actuator, a Morse code input device, etc.
Do you want to subscribe in order to receive notifications regarding "Tamper 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Tamper 2 click" changes.
Do you want to report abuse regarding "Tamper 2 click".
Library Description
The library covers all the necessary functions to control Tamper 2 Click board.
Tamper 2 click communicates with the target board through the AN and INT line.
This library detecting the state of switch on Tamper 2 click is changes to normally open or closed.
Key functions:
uint8_t tamper2_switchON()
- Switch ON detect function.uint8_t tamper2_switchOFF()
- Switch OFF detect function.Examples description
The application is composed of the three sections :
void applicationTask() { switchState = tamper2_switchON(); if ( switchState == 1 && switchStateOld == 0 ) { mikrobus_logWrite( " Closed ", _LOG_LINE ); mikrobus_logWrite( "- - - - - - - - -", _LOG_LINE ); switchStateOld = 1; } if ( switchState == 0 && switchStateOld == 1 ) { mikrobus_logWrite( " Open ", _LOG_LINE ); mikrobus_logWrite( "- - - - - - - - -", _LOG_LINE ); switchStateOld = 0; } }
Other 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.