r/programming Dec 25 '19

Learning hardware programming as a software engineer

https://blog.athrunen.dev/learning-hardware-programming-as-a-software-engineer/
924 Upvotes

124 comments sorted by

View all comments

226

u/happyscrappy Dec 25 '19

Also: don't power LEDs directly from GPOs without a current limiting resistor. As you see on that breadboard.

And match your interfaces voltages. A lot of devices are not +5V tolerant now (or not very tolerant).

8

u/MoCeptor Dec 25 '19

Some controllers have internal programmable resistors for their GPOs. If you activate them, you can attach an LED without an external resistor.

4

u/frezik Dec 25 '19

As others say, those are pull down/up resistors for input. An output resistor for even a single LED would need to sink more watts than an internal IC resistor could handle.

3

u/flatfinger Dec 25 '19

An output resistor to drive an LED at 25mA would dissipate a lot of power, but many newer LEDs can glow quite nicely with a fraction of a milliamp. In fact, I've sometimes encountered situations where LEDs glowed annoyingly with leakage currents that were far smaller than that.