Whats up everybody. So here is my plan. I am designing a stereo that has an MP3 player, Bluetooth, Fm Tuner and Aux In. I plan on the MP3 player immediately turning on, then using the pushbutton switch to cycle "modes". IE Turn off mp3/turn on bluetooth, press again to turn off bluetooth/turn on fm tuner etc. I am using solid state relays to distribute power to the devices and arduino to control the relays.
Here is a grid of my goal.
Device = MP3 Bluetooth FM Tuner
Power Up On Off Off
Press Button Off On Off
Press again Off Off On
Press again All OFF
Press again On Off Off
Etc
I have been researching for a couple weeks and have found many similar programs but there has always been some reason it wont work for me such as using multiple buttons or whatever the case may be. I have downloaded an Arduino Command reference book, watched tutorials on youtube and though I had an understanding of the code but apparently not.
Here is my code so far just for the first 2 modes. I have uploaded and nothing happens whatsoever with my device, unfortunately as this is my first arduino project, I am completely lost and have no idea where to go or what to do. Please point me in the right direction. Any help is greatly appreciated.
I am running Arduino Uno on 5 Vdc and I am using LED's before I actually connect the relays.
void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT); //Mode Switch
pinMode(5, OUTPUT); //MP3 Player
pinMode(6, OUTPUT); //Bluetooth
digitalWrite(5, HIGH); //Run MP3 on Startup
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead == (2, HIGH)); // When Mode button is pushed...
digitalWrite(5, LOW); // Turn off MP3 Player
delay(100);
digitalWrite(6, HIGH); //Turn on Bluetooth
if (digitalRead == (2, HIGH)); // When Mode button is pushed
digitalWrite(6, LOW); //Turn off Bluetooth
delay(100);
digitalWrite(5, HIGH); //Turn on MP3 Player
}