This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.


Digital output pin 5V

Alexandra Tidrea

I have a MDUINO21+ powered at 12V and I want to configure a digital output pin on 5V. I have seen that one option might be to use Pin2/Pin3. If someone can guide me in the right direction, the help will be much appreciated. 

1 Answer
Bernat Brunet Pedra
Best Answer

Dear Alexandra, 

Yes, you are right. Pins 2 and 3 are one of the options to set a digital output to 5V, with just this lines of code (for Pin 2):

pinMode(2, OUTPUT);

digitalWrite(2, HIGH);

In addition, any digital output from the B Zone can also output 5V with:


digitalWrite(Q0_0, HIGH);

(for pin Q0_0). Check the serigraphy on the PLC to know the exact name.

Remember that to get 5V from this pins, you will need to power the outputs with the desired voltage (5V in your case) with an external power supply. If wanting to get different voltage output, change the power supply voltage to whatever value you need.

The pins destinated to do this job are: QVdc and COM (-), for volatge (+) and GND (-), respectively.

The difference between the options is that Pin 2 and 3 can only give 5V, but the outputs from the second layer of the PLC can give between 5V and 24V, depending on the correspondent power supply pins mentioned before. Please read the manual for a deep understanding.