ped
0
- Joined
- Nov 25, 2008
- Messages
- 4,889
- Points
- 113
Basically, I need a timer circuit to go with my Ozone generator that fires it for 5 seconds in every 60..
Ideas?
Ideas?
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Honestly the easiest and cheapest method is probably just throwing a microcontroller at it.
...Your code would be very simple ,
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5000); // wait for 5 seconds
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(55000); // wait for 55 seconds
}
/* Ped's Ozone Timer
* Written by Matt "Sigurthr" Giordano
* 2016/1/23
* www.SigurthrEnterprises@blogspot.com
* SigurthrEnterprises@gmail.com
* This code only works when timeperiod > Ontime.
*/
unsigned long blinkerMillis = 0;
unsigned long currentMillis = 0;
unsigned long previousMillis = 0;
unsigned long highMillis = 0;
int ontime;
int timeperiod;
unsigned long onmillis;
unsigned long offmillis;
void setup() {
pinMode(3, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(3, LOW);
digitalWrite(13, LOW);
ontime = 5; // time in seconds to be ON
timeperiod = 60; // time in seconds to be ON + OFF
onmillis = 1000 * ontime;
offmillis = 1000 * timeperiod;
}
void loop() {
currentMillis = millis();
if (currentMillis >= blinkerMillis + 1000){
blinkerMillis = currentMillis;
digitalWrite(13, HIGH);
}
if (currentMillis >= previousMillis + offmillis) {
previousMillis = currentMillis;
highMillis = currentMillis;
digitalWrite(3, HIGH);
}
if (currentMillis >= highMillis + onmillis){
digitalWrite(3, LOW);
}
if (currentMillis >= blinkerMillis + 150){
digitalWrite(13, LOW);
}
if (currentMillis < previousMillis){
previousMillis = 0;
}
if (currentMillis < blinkerMillis){
blinkerMillis = 0;
}
if (currentMillis < highMillis){
highMillis = 0;
}
}