TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137074 times)
  2. FAT32 Library (70221 times)
  3. Network Ethernet Library (56094 times)
  4. USB Device Library (46407 times)
  5. Network WiFi Library (42028 times)
  6. FT800 Library (41371 times)
  7. GSM click (29109 times)
  8. mikroSDK (26550 times)
  9. PID Library (26487 times)
  10. microSD click (25483 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

Button ALARM click

Rating:

5

Author: MIKROE

Last Updated: 2019-09-25

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Pushbutton/Switches

Downloaded: 2514 times

Not followed.

License: MIT license  

Button Alarm Click is a very interesting interactive gadget on a Click board. It is an integrated capacitive touch sensor display in the form of a button.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Button ALARM click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Button ALARM click" changes.

Do you want to report abuse regarding "Button ALARM click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Button ALARM click

Button ALARM click

Native view of the Button ALARM click board.

View full image
Button ALARM click

Button ALARM click

Front and back view of the Button ALARM click board.

View full image

Library Description

The library covers all the necessary functions to control Button ALARM Click board. The library contains a function that checks and returns the state of the alarm button - whether it is pressed or not. Using the PWM function, you can adjust the LED light of the alarm button.

Key functions:

  • uint8_t buttonalarm_getButtonState() - Gets state of the alarm button function.

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes GPIO and LOG structures, set INT pin as input and start to write log.
  • Application Initialization - Initialization driver enable's - GPIO, PWM initialization set PWM duty cycle and PWM frequency, start PWM, also to write log.
  • Application Task - This is an example which demonstrates the use of Button ALARM Click board. This example shows the automatic control of the alarm button. When we press and hold button, button stops blinking and start dimming. Results are being sent to the Usart Terminal where you can track their changes. All data logs on usb uart for approximately every 1 sec when the data value changes.
void applicationTask()
{
    buttonState = buttonalarm_getButtonState();
    
    cnt = 0;
    while ( ( cnt < 200 ) && ( buttonState == _BUTTONALARM_BUTTON_STATE_OFF ) )
    {
        buttonState = buttonalarm_getButtonState();
        buttonalarm_pwmSetDuty( _BUTTONALARM_DUTY_CYCLE_ON );
        cnt++;
        Delay_ms( 1 );
    }

    cnt = 0;
    while ( ( cnt < 200 ) && ( buttonState == _BUTTONALARM_BUTTON_STATE_OFF ) )
    {
        buttonState = buttonalarm_getButtonState();
        buttonalarm_pwmSetDuty( _BUTTONALARM_DUTY_CYCLE_OFF );
        cnt++;
        Delay_ms( 1 );
    }

    if( buttonState )
    {
        mikrobus_logWrite("  Button is pressed  ", _LOG_LINE);

        while ( dutyCycle < _BUTTONALARM_DUTY_CYCLE_ON )
        {
            dutyCycle += 200;
            buttonalarm_pwmSetDuty( dutyCycle );

            if ( dutyCycle > _BUTTONALARM_DUTY_CYCLE_ON )
            {
                dutyCycle = _BUTTONALARM_DUTY_CYCLE_OFF;
                buttonalarm_pwmSetDuty( dutyCycle );
                Delay_ms( 100 );
            }
            Delay_ms( 50 );
        }
        dutyCycle = _BUTTONALARM_DUTY_CYCLE_OFF;
        mikrobus_logWrite( "---------------------", _LOG_LINE );
    }
}

Additional Functions :

  • uint32_t buttonalarm_pwmInit( uint16_t freq ) -Initializes the Timer module in PWM mode.
  • void buttonalarm_pwmSetDuty( uint16_t duty ) -The function changes PWM duty ratio.
  • void buttonalarm_pwmStart() -Starts appropriate PWM module.
  • void buttonalarm_pwmStop() -Stops appropriate PWM module.

Other mikroE Libraries used in the example:

  • PWM
  • UART

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

RiBUS click

0

RiBUS Click is an adapter Click boardâ„¢ that allows a mikroBUS to interface with RiBUS compatible display modules.

[Learn More]

Step Up click

0

Step Up Click is a fixed frequency DC-DC step-up (boost) regulator, which can be obtained from any low voltage input - such as NiCd, NiMH or one cell Li-Po/Li-Ion batteries.

[Learn More]

H-Bridge 5

5

The H-Bridge 5 Click is designed for control DC motors and inductiv loads. This Click board contains the MP6515GF-Z, a H-bridge motor driver from MPS, It features an Full H-Bridge driver with Internal safety features include over-current protection, input over-voltage protection, under voltage lockout (UVLO), and thermal shutdown.

[Learn More]