What is criteria to calling analog_in.changed()?

Hi, I was trying to read raw values from a gyro and was using analog_in on the triport. Seems that the changed() callback has some threshold on the magnitude of the difference in readings. When i just put a loop spinning on a timer, I see the raw value bouncing around quite a bit (as expected), but the callback does not get triggered unless the difference between readings is ~5 from what I can tell (comparing12bit values). I assume this is intended behavior?

Thanks,
Nick.

yes, but the event should be triggered if the delta is > 2.

Edit: actually looks it’s a delta of > 2 in a 10mS time period, so if the value is changing really slowly it doesn’t generate an event. I have no idea why we decided to do it that way, code was committed 6 years ago. I don’t think anyone ever uses these events.

3 Likes

Awesomes, thanks for the reply - for some reason i didn’t get notification or I would have acknowledged sooner. That matches what I’m seeing, thanks.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.