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-03-15
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: Pushbutton/Switches
Downloaded: 3971 times
Not followed.
License: MIT license
Keylock click carries a processed sealed key lock mechanism that can be set in three different positions. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over the PWM, INT, and AN pin on the mikroBUSâ„¢ line.
Do you want to subscribe in order to receive notifications regarding "Keylock click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Keylock click" changes.
Do you want to report abuse regarding "Keylock click".
Library Description
The library covers all the functions necessary to control Keylock click board. Keylock click
communicates with the target board through the AN, PWM and INT line. This library
offers functions for detecting the state in which the key currently is, as well as fuctions
that allow you to check the state of each of the pins used by Keylock click board.
Key functions:
uint8_t keylock_getPosition();
- Function is used to check in which position the key currently is.Examples description
The application is composed of three sections:
void applicationTask() { newState = keylock_getPosition(); if( oldState != newState ) { if( newState == _KEYLOCK_KEY_POS_1 ) { mikrobus_logWrite( " Position ONE ", _LOG_LINE ); } else if( newState == _KEYLOCK_KEY_POS_2 ) { mikrobus_logWrite( " Position TWO ", _LOG_LINE ); } else if( newState == _KEYLOCK_KEY_POS_3 ) { mikrobus_logWrite( " Position THREE ", _LOG_LINE ); } else { mikrobus_logWrite( " ERROR!!! ", _LOG_LINE ); } oldState = newState; mikrobus_logWrite( "---------------", _LOG_LINE ); } Delay_ms( 500 ); }
Other mikroE Libraries used in the example:
UART
Additional notes and informations
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