Write Digital Outputs Ardbox/MDuino

Write Digital Outputs Ardbox/MDuino

Digital  Ouputs (0-24Vdc): Ardbox

  • Analog: Q0.0, Q0.1, Q0.2 (Digital); Q0.3, Q0.4, Q0.5, Q0.6, Q0.7, Q0.8, Q0.9 (configurable Digital)
  • Relay:  –

M-Duino

  • M-Duino 21: Q0.0, Q0.1, Q0.2, Q0.3, Q0.4 (Digital); Q0.5, Q0.6  Q0.7  (configurable Digital).
  • M-Duino 42:  Q0.0, Q0.1, Q0.2, Q0.3, Q0.4, Q1.0, Q1.1, Q1.2, Q1.3, Q1.4 (Digital); Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7 (configurable Digital).
  • M-Duino 58: Q0.0, Q0.1, Q0.2, Q0.3, Q0.4, Q1.0, Q1.1, Q1.2, Q1.3, Q1.4, Q2.0, Q2.1, Q2.2, Q2.3, Q2.4(NC) (Digital); Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7, Q2.5, Q2.6  Q2.7 (NC) (configurable Digital).
  • M-Duino 19R: Q0.0, Q0.1, Q0.2 (configurable Digital).
  • M-Duino 38R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2 (configurable Digital).
  • M-Duino 57R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2, Q2.0 (NC), Q2.1, Q2.2 (configurable Digital).

In this post we are going to learn how to define the state of the digital outputs. In this example digital output Q0.0 (Ardbox Analog) is set to HIGH state and after some time again to LOW state. When  Q0.0 is HIGH the Q0.0 PLC  connection will  provide 24Vdc, conversly when Q0.0 is set to LOW Q0.0 PLC connection will provide 0V.   This code could be used to make a LED blink.  The same code could be reproduced for any other digital output.

int Q00 = 13;

void setup() {

pinMode(Q00, OUTPUT);
}

void loop() {

digitalWrite(Q00,HIGH); // output Q00 set to HIGH state (on).
delay(500);             // wait 500 ms
digitalWrite(Q00,LOW);  // output Q00 set to LOW state (off).
delay(500);             // wait 500ms
}

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 Q01 = 11;   
void setup(){ 

pinMode(Q01, OUTPUT);   
}
Comments are closed.