Clicker 4 Button Not Working

General discussion on mikroElektronika development boards.
Post Reply
Author
Message
aminhusni
Posts: 4
Joined: 13 Feb 2022 23:09

Clicker 4 Button Not Working

#1 Post by aminhusni » 14 Feb 2022 03:25

Hi,

I just got a Clicker 4 STM32 board. The LED works but I can't seem to get the button working.
I am using Codegrip to flash it with NECTO Studio.

Appreciate if anyone can point me in the right direction.

Here is my code:

Code: Select all

// ------------------------------------------------------------------ INCLUDES
#include "drv_digital_in.h"
#include "drv_digital_out.h"

// ------------------------------------------------------------------ VARIABLES
static digital_in_t input_pin;    // Digital input driver context structure.
static digital_out_t output_pin;  // Digital output driver context structure.


// ------------------------------------------------------------------ USER CODE
void main()
{
    uint8_t value;

    digital_in_init( &input_pin, PG8 );
    digital_out_init( &output_pin, PG0 );


    while(1)
    {
        value = !digital_in_read( &input_pin );    // Read digital input value.
        digital_out_write( &output_pin, value  );  // Write read value to GPIO port.
    }
}

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 4 Button Not Working

#2 Post by filip » 18 Feb 2022 12:13

Hi,

Have you tried running the code through the debugger to see what is going on ?

Regards,
Filip.

aminhusni
Posts: 4
Joined: 13 Feb 2022 23:09

Re: Clicker 4 Button Not Working

#3 Post by aminhusni » 20 Feb 2022 11:53

filip wrote:
18 Feb 2022 12:13
Hi,

Have you tried running the code through the debugger to see what is going on ?

Regards,
Filip.
The code seems fine. I used the other GPIO pin to trigger it (D7 header) and the LED reacts to it.
I just can't get the on-board button working and there is no example or demo code for Clicker 4 STM32 specifically around to reference :(

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 4 Button Not Working

#4 Post by filip » 28 Feb 2022 12:35

Hi,

Have you managed to get this working ?

Regards,
Filip.

aminhusni
Posts: 4
Joined: 13 Feb 2022 23:09

Re: Clicker 4 Button Not Working

#5 Post by aminhusni » 02 Mar 2022 12:57

filip wrote:
28 Feb 2022 12:35
Hi,

Have you managed to get this working ?

Regards,
Filip.
Unfortunately, no. Everything else seeems to work. GPIO UART pins, Input pins, Mikrobus modules etc. are all working. Only the on-board buttons are not working for some reason.
Is there some special register or configuration that has to be done for the GPIO to work in input mode for certain ports?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Clicker 4 Button Not Working

#6 Post by filip » 11 Mar 2022 12:08

Hi,

There is no special register, your code seems to be fine.

I will see if I can think of anything else.

Regards,
Filip.

mislavhas
Posts: 2
Joined: 24 Feb 2022 10:17

Re: Clicker 4 Button Not Working

#7 Post by mislavhas » 14 Apr 2023 14:10

Hi,

Has anyone found a solution to this problem? I am also trying to get the button working and interact with LED on my Clicker 4 for STM32 but it doesn't respond when I click the button.

Post Reply

Return to “Development Boards”