AS5600: AS5600_COUNTERCLOCK_WISE fails
If you issue as5600.setDirection(AS5600_COUNTERCLOCK_WISE) at setup, as5600.rawAngle() * AS5600_RAW_TO_DEGREES always returns 337 degrees. AS5600_CLOCK_WISE works correctly. I’m just performing a simple measurement for a wind vane so I haven’t tried anything more than the basic code.
To work around this for reading CCW, you can find the corrected value with angle = 360 - angle; (adjusting for ints, floats, or whatever variable type you use).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 31 (22 by maintainers)
Sorry, been a really bad week. The main sewer line to my house completely plugged up and by the time we got it fixed Thursday I had forgotten all about this.
So back to the subject at hand… When not defining a pin number in the begin() statement this does in fact appear to be working with AS5600_demo_software_direction.ino. As it switches back and forth between CW and CCW modes I keep rotating the magnet in a CW direction and the output increases or decreases in angle as expected.
I should have some time this evening, so I’ll wire up the DIR line to a pin on my esp8266 and verify that the hardware mode also still works.
Additionally, my weather station has been operating all week with a wind vane (the first AS5600 I set up), and that has been operating very reliably, so I don’t think there are any major problems with the code for long-term use. My hardware actually reads in the CCW direction so I’ll load up the new code and confirm there are no issues there.