I have been trying to control a higher voltage than 5 volts by connecting a PNP transistor to the Arduino but it doesn't seem to work. But Urika!!! I finally got it to work with using two transistors first an NPN and then a PNP!
@@TasteTheCode I was spacific enough but anyway what I was saying is that I was trying to use an Arduino to drive another part of my circuit that runs on 15 volts, that would burn up the Arduino so first I thought I could just use an NPN transistor to do that but it wouldn't work... This is going to be a very lengthy explenation so I will have to make a video myself.
@@TasteTheCode Sorry I'm confused then. I thought you switched the digital output to LOW in the code when the current was sinking? Overall I'm trying to figure out how to wire 4 different LEDs given the 4 cases: Turn on LED 1 only when current sourcing and driven High. Turn on LED 2 only when current sourcing and driven Low. Turn on LED 3 only when current sinking and driven High. Turn on LED 4 only when current sinking and driven Low.
@@andygay7305 There are no 4 states with current sinking/sourcing. If the pin is driven HIGH, it presents the input voltage on the output. It can only be connected via the LED and its resistor to LOW so the current can flow. That is sourcing. In the other case, if the LED and its resistor are connected to HIGH already, the only way current can flow is if the Arduino is driven LOW so there is a potential difference. If the LED is already connected to HIGH and the pin is HIGH, they are both at the same potential and no current will flow so the LED stays off. I hope that this makes it clearer.
@@TasteTheCode Thank you so much for your help. I just found out the part of the example I was giving above was a trick question. Now it makes perfect sense!
@@nayrbsworld3048 I'm not familiar with those but they should be just glorified microcontrollers so the wiring should be the same. It is best to consult their manual or documentation.
Great video, the drawing helped a lot, thanks!
Thank you! I'm glad it helped!
I have been trying to control a higher voltage than 5 volts by connecting a PNP transistor to the Arduino but it doesn't seem to work. But Urika!!! I finally got it to work with using two transistors first an NPN and then a PNP!
What doesn't work? You need to be more specific so I can help.
@@TasteTheCode I was spacific enough but anyway what I was saying is that I was trying to use an Arduino to drive another part of my circuit that runs on 15 volts, that would burn up the Arduino so first I thought I could just use an NPN transistor to do that but it wouldn't work... This is going to be a very lengthy explenation so I will have to make a video myself.
Very helpful! Can you also run current to an LED when sinking current and digital output is HIGH? If so, how would you wire that?
That is exactly my example in the video :D
@@TasteTheCode Sorry I'm confused then. I thought you switched the digital output to LOW in the code when the current was sinking? Overall I'm trying to figure out how to wire 4 different LEDs given the 4 cases: Turn on LED 1 only when current sourcing and driven High. Turn on LED 2 only when current sourcing and driven Low. Turn on LED 3 only when current sinking and driven High. Turn on LED 4 only when current sinking and driven Low.
@@andygay7305 There are no 4 states with current sinking/sourcing. If the pin is driven HIGH, it presents the input voltage on the output. It can only be connected via the LED and its resistor to LOW so the current can flow. That is sourcing. In the other case, if the LED and its resistor are connected to HIGH already, the only way current can flow is if the Arduino is driven LOW so there is a potential difference. If the LED is already connected to HIGH and the pin is HIGH, they are both at the same potential and no current will flow so the LED stays off. I hope that this makes it clearer.
@@TasteTheCode Thank you so much for your help. I just found out the part of the example I was giving above was a trick question. Now it makes perfect sense!
@@andygay7305 Awesome! I'm glad you figured it out!
is it the same wiring in the the plc?
What plc? I'm not sure that I understand your question...
@@TasteTheCode i mean wiring a d.i. in PLC programmable logic controller like Allen Bradley PLC.
@@nayrbsworld3048 I'm not familiar with those but they should be just glorified microcontrollers so the wiring should be the same. It is best to consult their manual or documentation.