Author Topic: Button Logic | Math  (Read 7660 times)

Offline Keithang

  • PLUS+1 Developer
  • ***
  • Posts: 20
  • Karma: +0/-0
Button Logic | Math
« on: April 20, 2017, 08:07:35 AM »
Hi Guys,

I want to enable a climb of numbers on a display if a button is pressed for longer than 500ms and go up\down in increments of 50. I am battling to get this to work, using the counter currently that only allows for 1 integer increase.

Any help would be appreciated.

Thank you

Offline Marbek_Elektronik

  • PLUS+1 Guru
  • *****
  • Posts: 352
  • Karma: +8/-0
    • Marbek Elektronik
Re: Button Logic | Math
« Reply #1 on: April 20, 2017, 08:53:16 AM »
one solution
Marbek Elektronik, Dipl.-Ing. Bernd Konrad
Dienstleistung, Entwicklung, Herstellung

Offline G30RG3

  • PLUS+1 Expert
  • ****
  • Posts: 71
  • Karma: +3/-0
Re: Button Logic | Math
« Reply #2 on: April 21, 2017, 11:00:11 AM »
There are several ways to do this:
 You can use the counter you're using now, divide the input before and multiply the output after the counter,  only symmetrical up and down possible
 You can use the Marbek way,
 Or you create a loop with value connects one on the rising, one on the falling edge of your signal, where you add or subtract the values you want. you'll need to set limits: see Marbeks solution