Skip to main content
LKlen.1
Associate
Feb 13, 2023 1:02 PM UTC
Question

Hi Everyone, I'm total rooki, I just start in stm32 an TouchGFX when I push my "buttonWithIcon1" I need reset on my pin PD6 and otherwise see myscreen2View.cpp for example:

void Screen2View::up1()

{

   if (buttonWithIcon1.getPressedState()==true) HAL_GPIO_WritePin(GPIOD, GPIO_PIN_6,GPIO_PIN_RESET);

   else HAL_GPIO_WritePin(GPIOD, GPIO_PIN_6,GPIO_PIN_SET);

}

what is wrong, thans for help

This topic has been closed for replies.

4 replies

Romain DIELEMAN
ST Employee
Feb 14, 2023 3:59 AM UTC

Hi,

Could you give a bit more information on how you set this up and what is the error you are facing ? have you properly defined those pins, included the hal, what is the "up1" function, when is it called, etc

This video from Gustavo might be of help as well. It explains how to communicate between the hardware and TouchGFX, in this case a LED is toggled for example when a button is pressed.

/Romain

Piranha
Principal III
Feb 14, 2023 10:22 AM UTC

Beginners should start with beginner topics, not a huge and complex projects...

LKlen.1
LKlen.1Author
Associate
Feb 14, 2023 10:32 AM UTC

hi,

Function "up1" is named lifting up the blinds.

in my code is no errors but it not works. I just want to change value from high to low on my pin PD6 when I pushing the "buttonWithIcon1" and I dont know how correctly use "IF" in this case?

/Lucas

Romain DIELEMAN
ST Employee
Feb 15, 2023 2:32 AM UTC

Are you sure your up1 function is actually called first ? Could you add a printf and see if you go inside this function and if it reacts as you want when the button is pressed ?

/Romain