4 ms·
Nice! Needs just a tweak to prevent the overshoot and bounce when going from high to low.
by floxy 5mo ago
Nice! Needs just a tweak to prevent the overshoot and bounce when going from high to low.
- JKCalhoun 5mo agoWut? We add extra lines of code just to get that in digital? ;-)
- padolsey 5mo agoNah the bounce is gorgeous
- adrian_b 5mo agoFor that, you just need to not make the transition from 100% duty cycle to 0% duty cycle instantaneous, but to ramp down linearly the duty cycle over a large fraction of a second or even an entire second. As another poster said, the overshoot may look cool, but I would be worried that a cheap panel voltmeter would not survive a very large number of such shocks.
- invalidator 5mo agoYou can do better: cut to 0%, let the needle fall, go back to 100% for a moment to catch the needle as it approaches the bottom of the scale. If you want to be fancy, add some quick sinusoidal ramps to smooth out the derivative.
- Doxin 5mo agoA linear ramp would work, but you can probably get to the end-point quicker if you're not going linearly. Something like needle_position = needle_position * 0.9 + desired_needle_position * 0.1 is very easy to implement, easier than linear if you ask me, and should give it a nice damped movement. The constants can be tuned to go as quick or as slow as you like of course.
- floxy 5mo ago>just https://duckduckgo.com/?ia=web&q=control+theory https://duckduckgo.com/?ia=web&q=control+theory
- PunchyHamster 5mo agomaking it worse with more code is not trend one should follow