cancel
Showing results for 
Search instead for 
Did you mean: 

How do we know if our hand is on the button at TouchGFX?

Freedom_Neo
Senior

How do we know if our hand is on the button? e.g; If our hand is on a button, the led is always on, if we raise our hand over that button, the led turns off.

16 REPLIES 16
MasterT
Lead

Proximity sensors. Capacitive, thermal, IR reflective, make your choice.

What kind of "button" may have an influence...

Freedom_Neo
Senior

You misunderstood the question as the title is incorrect. I meant the prepare button with TFT GUI. You can read the post below.

https://community.st.com/s/question/0D53W00001YdFteSAF/long-press-button-increment-fast-value

"You misunderstood the question as the title is incorrect"

:face_with_tears_of_joy: :grinning_face_with_sweat: :>

So what does the TouchGFX documentation tell you?

Presumably, you get an event to tell you when it's "touched", and another to tell when that touch has gone away ... ?

"You can read the post below"

So why start a new thread if it's still the same question?

Did the solution provided there by @Yoann KLEIN​  not work?

Freedom_Neo
Senior

It's okay to detect that you're touching the button. I can't detect that you're pulling your hand away from the button

Did the solution provided there by @Yoann KLEIN (ST Employee)​ not work?

No, dont work

"No, dont work"

Then feed-back in the other thread so that he can help you further...

"I can't detect that you're pulling your hand away from the button"

But that is exactly what the example that @Yoann KLEIN​ linked you to does:

0693W00000NqUg8QAF.pnghttps://community.st.com/s/question/0D50X0000CBl0asSQB/long-touch-detect-on-stm32l4r9aieval

I write below like this. But dont call handleClickEvent so dont get buttonPressedFlag = 1

void Ana_MenuView::handleClickEvent(ClickEvent& evt)
{
  if(evt.getType() == ClickEvent::PRESSED)
  {
	  buttonPressedFlag = 1;
  }
  else if(evt.getType() == ClickEvent::RELEASED)
  {
	  buttonPressedFlag = 0;
  }  
}
 
void Ana_MenuView::handleTickEvent()
{
	if (buttonPressedFlag)
	{
		temp_counter++;
		Unicode::snprintf(textArea2Buffer, TEXTAREA2_SIZE, "%d", temp_counter);
		textArea2.invalidate();
	}
}

Did you read & follow the rest of the linked thread?

Particularly, "Look at how a Button and AbstractButton is implemented" ...