In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote: Electronegativity, To calculate the resistor for the assumed 2.5V, I used this formula: R = (2.5V - 1.65V) / 3mA = 283.3 Ohm At first glance, you might think, reducing the voltage by 50% would also require reducing the resistor by 50%. But this is not the case because the LED's forward voltage is (almost) a constant of 1.65V. Thus, the voltage across the resistor is now 2.5 - 1.65V = 0.85V which is much lower than at 5V supply: 5 - 1.65V = 3.35V. Therefore, the resulting value is less than 50%. Well, what if we would reduce the duty cycle to achieve an effective voltage of 1.65V? According to my formula, the resistor would be 0 Ohms in this case, i.e. no loss at all. But you should keep in mind that this would cause high peak currents to be sourced from the output, so you better use a resistor of no less than 120 Ohms. This limits the peak current to some value below 30mA which is a safe value for the SX. If the LEDs are still bright enough, you can try to further reduce the duty cycle down to a value that still results in an acceptable brightness (w/o further reducing the resitor value). Yes, you are right, in case you have connected 10kOhm pull-up resistors between the inputs and +5V, each of the resistors will dissipate 2.5 mW as long as the switches pull the inputs low. You might consider using pushbuttons instead, and handle the toggle functions by software. In this case, power is dissipated only as long as the buttons are pressed. Don't forget to de-bounce the pushbuttons. You can do this by software. For example, when you poll the button states -say - every 20ms, you accept a state change ony, when the state is still the same after the next poll. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=89554#m89895 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)