Hi All,
Right I have no previous experience with an Arduino and have been tasked to create a lifecycle test (100,000 runs) for work for some valves which spring return. I had a quick look into these and thought they would do the trick.
I have therefore purchased the following arduino and 4 x relay.
http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/8750292/
http://uk.rs-online.com/web/p/motor-control-development-kits/1244687/?sra=pstk
Having followed a few videos I have copied the following code and it has worked for now. However after running for 4/5 hours the adruino or relay had stopped overnight. I therefore pressed the reset button on the arduino 4 relay shield and it continued.
My problem is that I do not know how to code the number of times it has run. It would be good to add a screen and show this but I was just going to work on the fact that the loop runs for 24 seconds and therefore in a 24hr day it would run in the region of 3600 times. Unfortunately if this stops I don't know when and why.
Is this a memory issue or do the code just reset after completing the loop?
Any help with what could be going wrong and if a counter could be added with ease, then it would be much appreciated? Or more importanatly can the arduino actually perform the task of running a code 100,000 times?
Thanks all in advance.
Matt
CODE
/4-Relays Shield Example/
//define variable
int RELAY1 = 4; **
int RELAY2 = 7;
int RELAY3 = 8;
int RELAY4 = 12;
void setup()
{ **
//set Relays as Output
** pinMode(RELAY1, OUTPUT); **
** pinMode(RELAY2, OUTPUT); **
** pinMode(RELAY3, OUTPUT); **
** pinMode(RELAY4, OUTPUT); **
}
** void loop()
{
** digitalWrite(RELAY1,HIGH); // Turns ON Relay1
** digitalWrite(RELAY2,HIGH); // Turns ON Relay2**
** digitalWrite(RELAY3,HIGH); // Turns ON Relay3**
** digitalWrite(RELAY4,HIGH); // Turns ON Relay4**
** delay(17000); // Wait 17 seconds**
** digitalWrite(RELAY1,LOW); // Turns ON Relay1**
** digitalWrite(RELAY2,LOW); // Turns ON Relay2**
** digitalWrite(RELAY3,LOW); // Turns ON Relay3**
** digitalWrite(RELAY4,LOW); // Turns ON Relay4**
** delay(7000); // Wait 7 seconds**
}