Hey! Thanks for reading!
Just started to get back into arduino and my electronics so, excuse my beginner questions.
My last post was getting some LEDs for my fish tank. I basically have some LED strips being powered by the arduino at different times of the day. Don't worry that I mentioned fish tank, these are all arduino questions, nothing about fish.
Ok, this is the code I was gonna use for it.
I basically just modified the blink sketch, nothing fancy.
int dayled= 12; //Define white LED strip as pin 12
int nightled= 11; //Define blue LED as pin 11
void setup() {
pinMode(dayled, OUTPUT);
pinMode(nightled, OUTPUT);
}
void loop() {
digitalWrite(dayled, HIGH); //Define brightness of White led as on
delay(54000000); //Wait in Milliseconds
digitalWrite(dayled, LOW); //Define brightness of White led as off
digitalWrite(nightled, HIGH);//Define brightneess of Blue leds as on
delay(32400000);
digitalWrite(nightled, LOW); //Define brightness of Blue leds as off
}
I have 2 different LEDs, some white ones for the day, and then some blue ones for night.
I have them hooked up by a MOSFET. I have 2 MOSFETS, 1 for the white LEDs, and another for the blue. I used this diagram to wire everything. I attached it below.
The LEDs are powered off a 12 volt 2 amp wall wart.
Ok, so that is what the pin 12 and 11 go to.
Buttttt here are my questions.
I would love to have a pot to fade the brightness of the LEDs, one for both LEDs would be great.
Next, I would like to have a SPST switch that I can hit and turn the LED strips off. Now, I know its possible to have this just on the output line from the arduino to the LED, but I would prefer doing it from the arduino since I am already using it. I always make it more complicated. Lol. This switch I would like to be just like a master switch, so whether the night LEDs (Blue) or the day LEDs (White) are on, they will turn off until I hit the switch again. I would like for it to be a Push Button Momentary Switch, but if a simple toggle switch would be easier, thats fine.
Also, is it possible instead of using the delay function, but to set like a arduino clock? That way the arduino counts like a clock, so I could say "Turn of White LEDs at 4" or something similar. Or the arduino could see that it is Saturday, so don't give power to the lights for another 3 hours.
Wow. That was a lot....
Guys I am super happy that you read this, and that you are willing to help me!