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: 4374 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.
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
Water Detect Click is used for detecting water and other electroconductive liquids.
[Learn More]DC Motor 12 Click is a compact add-on board with a brushed DC motor driver. This board features the TB9054FTG, a PWM-type, dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor. The TB9054FTG is rated for an operating voltage range from 4.5V to 28V, with the motor controlled directly through a PWM signal or SPI serial interface. In addition, this driver allows a dual configuration with two motors with 5A current ratings per channel or one 10A channel drive in a Parallel mode of operation. It also has complete diagnostic and protection capabilities supporting robust and reliable operation.
[Learn More]Expand 9 Click is a compact add-on board that contains a multi-port I/O expander. This board features the SX1509QB, the world’s lowest voltage level shifting GPIO expander from Semtech Corporation. The SX1509QB comes in a 16-channel configuration and allows easy serial expansion of I/O through a standard I2C serial interface. It also has a built-in level shifting feature making it highly flexible in power supply systems where communication between incompatible I/O voltages is required, an integrated LED driver for enhanced lighting, and a keypad scanning engine to implement keypad applications up to 8x8 matrix.
[Learn More]You have unsaved changes. If you choose to leave all changes will be discarded.
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".