mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Soft pwm error #124

Closed EAGrahamJr closed 1 year ago

EAGrahamJr commented 1 year ago

The previous PR was only tested with a servo device, which only reacts to a single pulse to activate, versus something like an LED which requires the constant inputs to keep the value.

On a hunch, replaced the lock-based sleep with the newer busy-wait and the previously observed jitter on the servo is almost entirely eliminated. Also tested with an LED, which also now does not exhibit a previously observed flickering (I thought I had lousy LED's :shrug:).

Bumped the log message to WARN so it's a bit more obvious that what is being used may not be what the user wanted. :smiley:

EAGrahamJr commented 1 year ago

Just as a note, I've also tested by setting the frequency higher than the default (100, 200) without any appreciable change in behavior.

mattjlewis commented 1 year ago

Thanks for your help improving diozero

EAGrahamJr commented 1 year ago

Thanks for your help improving diozero

It is very much my pleasure! Quite literally!