I'm trying to use the Arduino Opta Lite to engage and disengage pneumatic cylinders by energizing a solenoid valve with a 12 V coil. From my understanding, when the relay output is opened on the Opta it will have the same rating of the supplied voltage (which I have it powered by a 12 VDC power supply). When I run the program the relays open as they should, but they do not output any voltage. They do however have continuity between the contacts. Not sure if I'm missing something painfully simple or not.... here is the code:
int buttonState = 0; //sets button position to off by default
int counter = 0; //sets counter position to 0 by default
void setup() { //sets desired inputs and outputs
pinMode(BTN_USER, INPUT); //sets USER button as input
pinMode(D0, OUTPUT); //sets relay 1 as output
pinMode(LED_D0, OUTPUT); //sets STATUS LED 1 as output
pinMode(LED_D3, OUTPUT); //sets STATUS LED 4 as output
}
void loop() { //runs until counter = 100
buttonState = digitalRead(BTN_USER); //renames button status (on or off)
if (buttonState == LOW) { //if button is pressed
cycle();
}
}
void cycle() {
for (int counter = 0; counter < 5; counter++) { //defines loop to continue for 100 reps
digitalWrite(LED_D3, LOW);
digitalWrite(D0, HIGH); //turn on output relay 1
digitalWrite(LED_D0, HIGH); //turn on STATUS LED 1
delay(3000); //leaves LED and relay on for 3 seconds
digitalWrite(D0, LOW); //turn off output relay 1
digitalWrite(LED_D0, LOW); //turn off STATUS LED 1
delay(3000); //leaves LED and relay off for 3 seconds
if (counter == 4) {
digitalWrite(D0, LOW);
digitalWrite(LED_D0, LOW);
digitalWrite(LED_D3, HIGH);
}
}
}
