Latching and resetting outputs? End goal is a Boss Katana effects selectors

Hi

Newbie question. I want to make a guitar effects switching box. I have a background in BMS/PLC programming (logic block based) so I’m struggling with the base concepts of Arduino as my head is full of so called “Programming rules" that don’t apply here.

I have 4x momentary push button switches, used to switch channels Depending on what button is pushed it will lacth the two relays as per the attached table. It’s almost a binary converter. 1=00, 2=01, 3=10, 4=11

Obviously easy to turn an output on. But I don’t understand some control basics.

  1. How do I make the relay latch in it’s open or closed position?

  2. When I press another button to switch modes, will it override the previous command? Or do I have to initiate a reset of the previous latch each time a button is pressed? The latter sounds complex. As these buttons may be turned on in any order depending which effect I need.

Thanks, please let me know what else I need to provide.

For those wanting more details the Boss katana 50 uses a 3 pin (TRS - Tip, Ring, Sleeve) plug. Relay 1 is connected across the Ring & Sleeve; Relay 2 is connected across the Tip & Sleeve. Quite clever really.

Cheers

Arduino.png

First off look at the ‘ State Change Detection (Edge Detection)’ example.

When a switch goes to the pushed state do what you have to do with the outputs using:digitalWrite(pinNumber, HIGH); OR digitalWrite(pinNumber, LOW);

Scan your switches every ~50ms for poor mans debouncing.

Thank you, I'll have a play. I like the tutorial format explains each line.

I really need to flush my Brain or at least close half of it, off as I try to fit my current logic understanding into C++ and it will never fit.

konkonkaos:
I like the tutorial

The code is for a pin with an external pulldown resistor; it's more normal to turn on the internal pullup in pinMode, or use an external pullup.

So the example code looks for a press as a high: with a pullup, a press is low.