Skip to main content
LKlen.1
Associate
February 13, 2023
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:

  • February 13, 2023
  • 4 replies
  • 1070 views

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
February 14, 2023

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
February 14, 2023

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

LKlen.1
LKlen.1Author
Associate
February 14, 2023

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
February 15, 2023

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