Scratch2 starts using floating point at the drop of a hat, so if a user scales down an analog input (10 bit int) to an 8 bit value for PWM output the result is a floating point value. Scratch2 does have a 'round' function which can be used, but I think it would be good if s2a_fm also handled this. I had a quick look and the PWM case could be handled by changing line 454 of scratch_command_handlers.py from
Hi again,
Scratch2 starts using floating point at the drop of a hat, so if a user scales down an analog input (10 bit int) to an 8 bit value for PWM output the result is a floating point value. Scratch2 does have a 'round' function which can be used, but I think it would be good if s2a_fm also handled this. I had a quick look and the PWM case could be handled by changing line 454 of scratch_command_handlers.py from
to
There may be a more Python way of doing this, what do you think?
Thanks Dave