wavemaker

hi, i'm making a simple wave maker for reef aquarium.

i need help with code

trying to combine Blink with Debounce

so i can turn off the pumps for feeding

i want it to run the loop randomly turning pumps on and off, and when i press the button i want all pumps off possibly a 10 min timer then back to looping

want to use an attiny85, can an attiny85 power relays?

here is what i have https://circuits.io/circuits/3896497-the-unnamed-circuit

*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led_0 = 2;
int led_1 = 1;
int led_2 = 4;
int btn_1 = 5;
// the setup routine runs once when you press reset:
void setup() {
 // initialize the digital pin as an output.
 pinMode(led_0, OUTPUT);
 pinMode(led_1, OUTPUT);
 pinMode(led_2, OUTPUT);
}

// WAVE MAKER DELUX
void loop() {
 digitalWrite(led_0, HIGH);    // power on light
 digitalWrite(led_1, HIGH);   
 delay(2000);                   //pump1 on pump2 off
 digitalWrite(led_1, LOW);    
 digitalWrite(led_2, HIGH);   
 delay(2000);                 //pump2 on pump1 off
 digitalWrite(led_2, LOW);                
 digitalWrite(led_1, HIGH);   //pump1 on pump 2 off
 delay(2000);               
 digitalWrite(led_2, HIGH);    //both pumps on 
 delay(2000);               
 digitalWrite(led_1, LOW);   
 delay(2000);                 //pump2 on pump1 off
 digitalWrite(led_2, LOW);                 
 digitalWrite(led_1, HIGH);   
 delay(2000);               
 digitalWrite(led_1, LOW);                  
 digitalWrite(led_2, HIGH);   
 delay(1000);               
 digitalWrite(led_0, LOW);        
 delay(1000);

}

No Atmel chip can directly power relays. You need a transistor.

If you want it to respond to button clicks, you can’t use delay(). That just totally ignores all inputs for the duration of the delay. Start from the Blink-Without-Delay example.

Debounce isn’t actually necessary. If the button is pushed (or bounces) again inside the 10 minutes, then it makes sense to re-start the 10 minutes. The difference caused by bouncing will only add a few milliseconds to the 10 minutes.

thank you for your quick reply , im new to this I will start looking more at blink without delay.

how can i make dual blinkwithoutdelay random but with one pump always on and button for all pumps off or possible delay timer?

i have also an uno i can use thankyou.

Well, the Uno also can't drive relays directly.

Well, start with one blink-without-delay and try to add a second one. Then try to use the random() function to add some randomness.

oops, by relay i meant to say "relay module"lol.

can an attiny85 directly control a relay module like thishttps://www.amazon.com/gp/product/B0057OC6D8/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

overdose: can an attiny85 directly control a relay module like thishttps://www.amazon.com/gp/product/B0057OC6D8/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

Yes.