How to write a digital output

How to write a digital output

You can write a Digital Output (0 or 24V) through:

...
int myDigital;
...
void setup() {
   pinMode (5,OUTPUT);
}

void loop() {
   digitalWrite(5, HIGH);
}

With this piece of code you’ll put a voltage to the output PLC pin corresponding to the internal “5” pin. In this case, we put 24Vdc to the output. If we want to put 0Vdc, we have to change the “HIGH” value to the “LOW” value.   Note: The example pin “5”, is only an example. You need to check in your PLC which pin to use for reading, writing, or reading and writing. Only if your PLC is able to work as a digital output, then, you can send this code into it.

Comments are closed.