Being new to arduino this is going to be a very ambitious first project. My goal is to build a controller that will run all the offroading lights and a few other devices in my truck and be controlled by my Android radio. I can wire relays just fine so that isn't a problem but I don't know how to set up the programming to have 2 relays run together for the rear flood lights. What I want is a button that will act as a 3 way switch between on-off-auto. How I did this in my last truck was a 3 position switch with a 12v constant on one terminal the wire from the reverse sensor on the other and the relay signal going out on the common terminal. Any ideas on this?
What I want is a button that will act as a 3 way switch between on-off-auto.
A single-momentary button that switches between 3 (or more) states is fairly easy as far as the software-logic goes. Conceptually, it's just a counter that counts 1,2,3,1,2,3... That's just a counting-loop that resets to 1 every time it hits 4... (Except if you're a programmer, you'll count 0,1,2,0,1,2.... )
You will need to debounce switch (that can be done with a delay) because when you open or close a mechanical switch it bounces (opens & closes several times) within a few milliseconds. It happens too fast for humans to notice but the Arduino will see it and count one button-push as several and your counter-state will be erratic.
You'll also need at least one LED (and maybe 2 or 3 LEDs for the 3-states). You may be able to see if the lights are on (or maybe not) but you'll need at least one LED to indicate "auto".
If you haven't used a relay with the Arduino before - You'll need a driver circuit for the relays (a transistor or MOSFET for each relay, or a driver chip). Or, you can buy relay boards with a driver circuit built-on. Or, there are solid state relays that can be directly driven from the Arduino, but high-current solid state relays can be expensive (and if you go that way, make sure you get a solid state relay that's rated for DC... An AC solid state relay won't turn-off with DC.)
...and be controlled by my Android radio.
Radio???
Being new to arduino this is going to be a very ambitious first project.
As an "Arduino project" this is straightforward and not too difficult so it's a great first project! But, re-wiring your truck will be a fair amount of work.
Being new to arduino...
Read through the [u]Arduino Language Reference[/u]. If you've never programmed before you won't understand much of it, but it should give you an idea of what you can do and it's not a lot to read-through. Then, take a look at some of the [u]Example Programs[/u], and maybe try some of them.
And before you try actual relays, try "mocking-up" your project using LEDs, and work with the LEDs as you develop your software. It wouldn't hurt to also try driving a relay with something like the Blink LED example to make sure you've got that part figured-out, but I'd recommend simplifying the hardware during software development.
If you are new to programming, the biggest trick is to write and test, small bits of code at a time. For a beginner, that means one or two lines of code... Just enough to do something... Turn on an LED, or send a message to the serial monitor, or just enough so you can tell if it's working. Of course professional programmers write more than one or two lines at a time, but they never write the whole program without testing it's various parts.
Now, this isn't quite as easy as it sounds because the compiler has see a "complete program" that "makes sense" to the compiler. For example, if you delete the bottom-half of a working program you'll get a bunch of errors and it won't compile.
The two most important concepts in programming are conditional execution (if statements, etc.) and loops (doing something over-and-over, usually until some condition is reached).
BTW - Since the Arduino doesn't have a video screen, the Serial Monitor is one of your best testing & debugging tools. You can send-out little messages like "button pushed", or "starting timer", or you can send-out variable-values, etc... Anything that tells you what the program is doing so you can tell if it's doing the right thing or not...
Wiring isn't hard and it is a all new harness to control a set of flood and work lights and later air solenoids for the locking differentials. The radio I am looking at is based on a Android tabblet http://m.ebay.com/itm/7-Inch-Double-2DIN-Android-Stereo-Car-CD-DVD-Player-GPS-Navi-FM-Touch-Radio-/331890847841?nav=WATCHING_ACTIVE
. This will give me a clean interior without the switches all over the cab like I had in my 4runner.