Button assign (ON/OFF)

Discussion in 'Technical & Support' started by joaopitaes, Jun 23, 2018.

  1. joaopitaes

    joaopitaes Registered

    Joined:
    Nov 5, 2017
    Messages:
    33
    Likes Received:
    8
    Hi there.I just built a button box and i was wondering if there is any way to have the buttons for Ignition and headlights mapped for ON/Off buttons instead of momentary push buttons.

    I would like to turn them off when i put the button in off position, instead of having to put it off and on again to change their state.

    Thank You!
     
  2. ADSTA

    ADSTA Registered

    Joined:
    Nov 19, 2011
    Messages:
    2,013
    Likes Received:
    1,369
    I'll throw my 2 cents in.

    If the game had control assignments :
    Headlights on = ?
    Headlights off = ?
    Then yes, but seeing as it only has: Headlights = ?
    I think no, you can't do it.

    Now, I was only prepared to throw 2 cents in because I'm actually hoping someone will come in and say I'm wrong, thus I've only lost 2 cents. ;)
     
  3. Booth_doberman

    Booth_doberman Registered

    Joined:
    Oct 5, 2015
    Messages:
    187
    Likes Received:
    84
    Is your button box a "smart" box or just a bunch of switches (JBOS)? If you built it with a microcontroller like an arduino, it would be possible to write the software to do that. I built my button box with an Arduino Teensy, but I only used NO switches and not your standard on-off ones. With an Arduino-based box, you could download different configurations to the box based on whatever car you want to drive tonight.
     
  4. joaopitaes

    joaopitaes Registered

    Joined:
    Nov 5, 2017
    Messages:
    33
    Likes Received:
    8
    I do use an arduino to control it. Should i program it to send a button press signal everytime the button changes state?
     
  5. Booth_doberman

    Booth_doberman Registered

    Joined:
    Oct 5, 2015
    Messages:
    187
    Likes Received:
    84
    There's probably code out there already to read and handle an on/off switch. It seems easy...just poll the switch and wait for a change of state. But you have to know which state it started out in when you started the game. The switch could start in the on or off position, so a state change wouldn't tell you much except that it changed state. It might be better to poll it and read if it's high or low and act on that. I don't know how to do that, but I do know a little bit about Google so that's where I'd go.
     
  6. joaopitaes

    joaopitaes Registered

    Joined:
    Nov 5, 2017
    Messages:
    33
    Likes Received:
    8
    yes.Ill probably do that.ill set the Ignition default to ON and headlights default to OFF. I can add a function by pressing 2 or 3 buttons at the same time so tha button is deactivated so i can correct the switch in game. Thanks!
     
  7. davehenrie

    davehenrie Registered

    Joined:
    Jul 6, 2016
    Messages:
    7,480
    Likes Received:
    4,395
    Might not a rocker switch fulfill your expectations? A vertically mounted switch could use up for on and down for off. But, they both would have to be active buttons as opposed to a switch that is either on or off. {since off would not activate a command}
     
  8. Emery

    Emery Registered

    Joined:
    Oct 24, 2010
    Messages:
    3,035
    Likes Received:
    1,654
    I think you're going to need to read what rF2 believes is the state of the switch via a plugin, output status to the controller, and compare to actual state of switch so the controller can update rF2 to the current switch position.
     
  9. joaopitaes

    joaopitaes Registered

    Joined:
    Nov 5, 2017
    Messages:
    33
    Likes Received:
    8
    That would be a Nice way to solve it.but I dont know how to read the variables from the dll
     

Share This Page