Setting value between 0 and 10 with two buttons

Discussion and support for current Advanced Dash Loggers, Sport Dash Loggers and Club dash loggers

Setting value between 0 and 10 with two buttons

Postby Robin Poenisch on Fri Sep 19, 2008 10:39 pm

Hi,

is there a way, to count a value up and down with two buttons connected to ADL2? I want to generate and send a value over CAN. This value must not leave the defined range (e.g. 0 to 10) and should decrement if button 1 is pressed and increment if button 2 is pressed. This value should be incremented/decremented only once every time a button is pressed.

thanx
Robin
Robin Poenisch Motorsport
Engineering Services
Electronic Systems

http://www.facebook.com/Poenisch.Motorsport
http://www.poenisch-motorsport.de
Robin Poenisch
 
Posts: 53
Joined: Tue Aug 05, 2008 5:16 pm
Location: Weinstadt/Germany

Re: Setting value between 0 and 10 with two buttons

Postby DarrenR on Tue Sep 23, 2008 5:25 pm

Hi Robin,

There is a way to do this, but it is not an actual function. I've attached a configuration with the setup in it. It uses two GP off/on channels assigned to Switch input 1 and 2. These two channels are combined in a channel math function of one minus the other, to give a result channel (GP 1) that is -1 when one button is pressed and 1 when the other button is pressed, otherwise it is 0.
This is then applied to one axis of a 3D table with the other axis being the count number (GP 2). The data in the table is arranged so the result of the table (GP 3) is the same as GP 1 unless the count is 0 or 10, this limits the count to the range.
Another Channel Maths is used to add GP 3 to GP 2 where GP 2 is also the result of the function, Basicly GP 2 = GP 2 + GP 3. To stop GP 2 from running away while a button is pressed, the condition to run the Channel Maths is 'GP 1 Changed by 1'. This gives an edge trigger so the maths is only calculated when the GP 1 value actually changes.

This can be done slightly different ways, with limits and count by values changed to suit your needs.
Attachments
CountUpDown.D45
(234.42 KiB) Downloaded 1382 times
Darren Reynolds
MoTeC Research Centre - Melbourne, Australia.
DarrenR
MoTeC
 
Posts: 176
Joined: Thu May 01, 2008 2:15 pm
Location: Melbourne, Australia

Re: Setting value between 0 and 10 with two buttons

Postby Robin Poenisch on Tue Sep 23, 2008 7:00 pm

Thank you, Darren!
This config is exactly what i needed :P
I tried different things before by myself, but nothing was so easy to implement and to understand as yours.
Robin Poenisch Motorsport
Engineering Services
Electronic Systems

http://www.facebook.com/Poenisch.Motorsport
http://www.poenisch-motorsport.de
Robin Poenisch
 
Posts: 53
Joined: Tue Aug 05, 2008 5:16 pm
Location: Weinstadt/Germany

Re: Setting value between 0 and 10 with two buttons

Postby ElectronSpeed on Mon Oct 13, 2008 1:11 pm

Nicely done Darren.
ElectronSpeed
 
Posts: 49
Joined: Wed Jul 30, 2008 1:12 pm

Re: Setting value between 0 and 10 with two buttons

Postby PQatPIT on Tue Oct 21, 2008 5:37 pm

Robin Poenisch wrote:Hi,

is there a way, to count a value up and down with two buttons connected to ADL2? I want to generate and send a value over CAN. This value must not leave the defined range (e.g. 0 to 10) and should decrement if button 1 is pressed and increment if button 2 is pressed. This value should be incremented/decremented only once every time a button is pressed.


Eehh, what is this used for? Counting fallen or not fallen flagpoles here and there :D
PQatPIT
 
Posts: 77
Joined: Fri Jul 11, 2008 10:51 pm

Re: Setting value between 0 and 10 with two buttons

Postby IDP on Thu Sep 03, 2009 11:32 pm

Does anyone have a method for doing this or something similar with an SDL?
IDP
 
Posts: 164
Joined: Wed Aug 13, 2008 11:30 pm

Re: Setting value between 0 and 10 with two buttons

Postby DarrenR on Mon Sep 21, 2009 11:58 am

I haven't tried it, but you should be able to do the same function using 3D tables to do the maths.
So you would use three 3D tables, and put both switches through the user conditions with 'changed by 1' as the condition.
Darren Reynolds
MoTeC Research Centre - Melbourne, Australia.
DarrenR
MoTeC
 
Posts: 176
Joined: Thu May 01, 2008 2:15 pm
Location: Melbourne, Australia

Re: Setting value between 0 and 10 with two buttons

Postby thorstengsxr on Tue Sep 22, 2009 1:49 am

Hi

I think one of the mayor problems is, that you can't save gp3 if you switch off the sdl

regrads Thorsten
thorstengsxr
 
Posts: 51
Joined: Thu Jul 10, 2008 10:00 pm


Return to ADL3, SDL3 and CDL3

Who is online

Users browsing this forum: No registered users and 12 guests