Browsed by
Tag: switch

Write Relay Outputs Ardbox/MDuino Relay

Write Relay Outputs Ardbox/MDuino Relay

Ardbox Relay relay outputs (220V / 5A): 

  • R1, R2, R3, R4, R5, R6, R7, R8

MDuino Relay relay outputs (220V/ 8A):

  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7 (MDuino 19R)
  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7, R0.8,  R1.1, R1.2, R1.3, R1.4, R1.5, R1.6, R1.7, R1.8 (Mduino 38R)
  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7, R0.8,  R1.1, R1.2, R1.3, R1.4, R1.5, R1.6, R1.7, R1.8, R2.1, R2.2, R2.3, R2.4, R2.5 (NC), R2.6, R2.7, R2.8 (Mduino 57R)

 

In this post we are going to learn how to define the state of the relay outputs. In this example relay output R1 (Ardbox Relay)  is switched ON (switch closed) and switched OFF (switch opened).

relay_schematic

 

int R1 = 4;   

void setup() {   
pinMode(R1, OUTPUT);   

}   
void loop() { 
  
digitalWrite(R1,HIGH); // close the relay switch
delay(500);  // wait 500ms
digitalWrite(R1,LOW); // opens the relay switch
delay(500);
 }

The digital outputs pinout can be checked on the User Guides for each PLC. Otherwise,  Arduino IDE start files contain all I/O already declared and with the suitable pinMode defined. To reproduce the same code for the other outputs the pin number should be replaced by the corresponding Arduino pin matching the new Output.
i.e. (Ardbox Analog):

int R2 = 7;

void setup(){
pinMode(R2, OUTPUT);

}