TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 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 (137002 times)
  2. FAT32 Library (70121 times)
  3. Network Ethernet Library (56027 times)
  4. USB Device Library (46348 times)
  5. Network WiFi Library (41966 times)
  6. FT800 Library (41286 times)
  7. GSM click (29055 times)
  8. mikroSDK (26489 times)
  9. PID Library (26451 times)
  10. microSD click (25413 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: 2510 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

Touchpad 5 click

0

Touchpad 5 Click is a compact add-on board that easily integrates projected capacitive touch into user's applications. This board features the IQS550, a projected capacitive touch and proximity trackpad/touchscreen controller from Azoteq.

[Learn More]

RS485 2 click

0

RS485 2 click is an RS422/485 transceiver Click board™, which can be used as an interface between the TTL level UART and the RS422/485 communication bus.

[Learn More]

HOD CAP click

0

HOD CAP Click is a compact add-on board that adds a smart sensing solution to your application. This board features the AS8579, a capacitive sensor from ams OSRAM. The sensor features I/Q signal demodulation, parasitic influences from cable, and PCB protection. It has ten sense outputs, five of which come with sensing line filter circuits. This Click board™ makes the perfect solution for the development of autonomous driving applications such as hands-on steering wheel detection and detection of any human presence inside a vehicle or outside of the vehicle, e.g., for automatic trunk opener and more.

[Learn More]