Hi, i have a problem. For my project (WPF) i'm using relays on pins 9, 10, 11, 12
but when i plug the arduino in to the USB it turns on the relays like this:
ON, 1sec.
OFF 5 sec.
and then it stays ON.
What i would like to have is : when i plug it in to the USB it stays OFF untill my program says it to turn ON
(Everything is fine and working, once the WPF program is started)
Can someone please help me??
Thanks.
this is the code i have used:
void setup()
{
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if (Serial.available() > 0)
{
char c = Serial.read();
if (c == 'A')
{
digitalWrite(12, HIGH);
}
else if (c == 'B')
{
digitalWrite(12, LOW);
}
if (c == 'C')
{
digitalWrite(11, HIGH);
}
else if (c == 'D')
{
digitalWrite(11, LOW);
}
if (c == 'E')
{
digitalWrite(10, HIGH);
}
else if (c == 'F')
{
digitalWrite(10, LOW);
}
if (c == 'G')
{
digitalWrite(9, HIGH);
}
else if (c == 'H')
{
digitalWrite(9, LOW);
}
}
}