Hello,
I am looking to use pins 13 to 8 as led drives, I have it working with the pins outputting positive, is there a way to output a negative?
Thanks
Hello,
I am looking to use pins 13 to 8 as led drives, I have it working with the pins outputting positive, is there a way to output a negative?
Thanks
Digital pins output either a 1 or a 0, HIGH or LOW. That is to say, 5V or 0V. So to turn the light connected to a pin, resistor and ground off,
digitalWrite(LEDpin, LOW);
No, pins cannot output a negative voltage, if that is what you mean.
But they can "output" 0V (=LOW) which means they can "sink" current (= current flows into the pin to ground). This means you can connect an led (with series resistor) between 5V and the pin, and the led will light when you set the pin to LOW and off for HIGH.
You can even connect 2 LEDs to the same pin. One led (with series resistor) between 5V and the pin and another led (with another series resistor) between the pin and ground. When the pin is HIGH, one led will light and when it is LOW, the other led will light. You can even set the pin to INPUT and both LEDs will light (although not so bright).
Thank you for the help, I have got it working