Sure you can. This site isn't a great place for open-ended questions like this though. Since you have a serious real-world need I'll give you some guidance anyway.
You'd need to break it into pieces and solve each one in turn.
First create code that recognizes long and short presses (not using delay()
.) You'll probably want to respond on releasing the button, since at that point it's easy to tell if it was a long or a short press.
The pseudo-code might look something like this:
void loop()
if button_is_pressed
if !press_in_progress
press_in_progress = true
start = millis()
else
if press_in_progress //Button has been released
elapsed = millis() - start
press_in_progress = false
if elapsed > long_press_threshold
long_press_function()
else
short_press_function()
For controlling the relays, I suggest getting "digital" relays that are made to be controlled with 5V logic signals. Relays like this work well. (Link). Since you need to control 4 relays, a 4 channel model like this one would be a better choice. Note that you'll need a fairly high current power supply. A 2A 5V regulated supply should be plenty for both your Arduino and your relays, although it's more of a sure thing if you use separate power supplies for the arduino and the relays (that way the voltage to the arduino doesn't bounce around as the relays energize and de-energize.
You'll need a global variable for the currently active relay. The long press would increment that value modulo 4: (going from 0 to 3 and then back to 0)
relay_index = (relay_index + 1) % 4;
You'd need an array of 4 bools for the states of each relay:
bool relay_states[4];
The short press would toggle the state of the current relay
relay_states[relay_index] = !relay_states[relay_index];
Note that if you're more interested in solving your wheelchair problem cost-effectively than tinkering, this is the sort of thing that a maker space would be ideal for. There are lots of tinkerers there who love a challenge, and would likely pitch in and help you.