How to use the mapping pins of Industrial Shields boards

How to use the mapping pins of Industrial Shields boards

In this post it is showed how to use the mapping pins of Industrial Shields boards. Before using these pins it is necessary to download the Industrial Shields boards. Follow the next link to download the boards

These boards provide you Industrial Shields PLC mapping. How it works?

For example with this boards it is not necessary to figure out what Arduino pin belong to the Industrial Shields PLC. Just using directly this PLC pin, Arduino IDE will arrange the mapping for you. To reference to the Industrial Shields Pins it must be typed like this:

Digital Outputs: QX_X

Analog Outputs: AX_X

Relay Output: RX_X

Inputs (regardless if it’s analog or digital): IX_X  

Next it is showed a sketch example:

// In this case is selected the M-DUINO 58 board
void setup() {
  // Configure INPUT pins
  pinMode(I0_0, INPUT);
  pinMode(I0_1, INPUT);
  //...
  pinMode(I1_0, INPUT);
  pinMode(I1_1, INPUT);
  //...
  pinMode(I2_0, INPUT);
  pinMode(I2_1, INPUT);
  //...

  // Configure DIGITAL OUTPUT pins
  pinMode(Q0_0, OUTPUT);
  pinMode(Q0_1, OUTPUT);
  //...
  pinMode(A0_5, OUTPUT);
  //...
  pinMode(Q1_0, OUTPUT);
  pinMode(Q1_1, OUTPUT);
  //...
  pinMode(A1_5, OUTPUT);
  //...
  pinMode(Q2_0, OUTPUT);
  pinMode(Q2_1, OUTPUT);
  //...
  pinMode(A2_5, OUTPUT);
  //...
  
}

////////////////////////////////////////////////////////////////////////////////////////
void loop() {
  // Toggle pins once a second
  digitalWrite(Q0_0, HIGH);
  digitalWrite(Q0_1, HIGH);
  //...
  digitalWrite(Q1_0, HIGH);
  digitalWrite(Q1_1, HIGH);
  //...
  digitalWrite(Q2_0, HIGH);
  digitalWrite(Q2_1, HIGH);
  //...
  delay(1000);

  digitalWrite(Q0_0, LOW);
  digitalWrite(Q0_1, LOW);
  //...
  digitalWrite(Q1_0, LOW);
  digitalWrite(Q1_1, LOW);
  //...
  digitalWrite(Q2_0, LOW);
  digitalWrite(Q2_1, LOW);
  //...

  delay(1000);
} 

See also:

INSTALLING INDUSTRIAL SHIELDS EQUIPMENT TO THE ARDUINO IDE

Comments are closed.