Audio input selector with arduino

Hello, i am in progress in making an Audio input selector :sunglasses:

I allready made the PCB's, with the relay's. I am making it with 6 inputs. The relay's used are omron 5vdc. I allready have some transistors, and whatever i have to use for switching the relays on/off.

I need a setup, where i use two pushbuttons, one for switching to the next relay in the line, and one for switching to the one "before". A sort of counting up/down code.

Each relay have it's own pin for the coil on the pcb. - So i think i have to use 6 output from the ArduinoBoard to control each relay.

Could somebody help me started with the code for this ?

Jesper.

What you are describing is a state machine. Each time the "up" button is pressed, the state changes, to the next "higher" state. Each time the "down" button is pressed, the state changes to the next "lower" state.

The state needs to not go negative or too high.

The appropriate state will then define what is to be done on each pass through loop. More likely, there will be nothing to do except when transitioning from one state to the next.

Excatly a state machine (a word i was looking for).

Do you have a code for that, to get me going for a start ?

Jesper.

BTW: Isen't it possible to attach a picture here ???

Sure you can add pictures. Host them somewhere like flickr, and create a link to that site, using the image tool.

What code do you need? Can you read the switch states? Can you determine when the switch state changed? Can you increment or decrement a variable? Can you test that a value is not less than some value? Not greater then some value?

If you can do these, you know when the state transition occurs. What happens at the transition is unique to your project, and only you can code that.

Ok, i got the message...

I will post later in progress when i have wrote some code.

Jesper.

I am a software guy, but this seems like just the kind of thing you could solve with some ICs and some resistors, transistors and maybe a couple of diodes?

/me is feeling like a heretic

Yeaa... I know i could use som "logic" TTL's. .. But i am planning using the arduino with a display, so i can see, witch input is selected...