Hello all first time poster here on the forums.Am currently looking to get back into Reef Aquariums since my 3yr old is getting into the saltwater fish.I have been following various threads at different places but unfortunately most of them use the UNO or compatible.I did however find one very promising thread that uses the MEGA instead and a touch screen.I have 3-4 questions for those of you willing to help this noob out.
-
Is it as simple as cut and paste the code provided you change the pins?As i'd like to add a wave maker to the sketch.
The Stilo v2.1 Sketch -
Would the following code copied and pasted work with it,two parts?
What i'd like to add....
PT1
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| S I M P L E O N A N D O F F F E A T U R E |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
const int ledPin1 = A2; // pin number for relay 1 was digital pin 2
const int ledPin2 = A3; // pin number for relay 2 was digital pin 8
int ledState1 = LOW;
int ledState2 = LOW;
long previousMillis1 = 0;
long previousMillis2 = 0;
long interval1 = 30000; // interval at which to blink (milliseconds) for RELAY1
long interval2 = 50000; // interval at which to blink (milliseconds) for RELAY2
PT2
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| D E F I N E : R E L A Y 1 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
void relay1() //FUNCTION TO TURN ON AND OFF RELAY 1.
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis1 > interval1)
{
previousMillis1 = currentMillis;
if (ledState1 == LOW)
ledState1 = HIGH;
else
ledState1 = LOW;
digitalWrite(ledPin1, ledState1);
}
}
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| D E F I N E : R E L A Y 2 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
void relay2()
{
unsigned long currentMillis2 = millis();
if(currentMillis2 - previousMillis2 > interval2)
{
previousMillis2 = currentMillis2;
if (ledState2 == LOW)
ledState2 = HIGH;
else
ledState2 = LOW;
digitalWrite(ledPin2, ledState2);
}
}