pico_as5600 is a library for the Pico C/C++ SDK to interface with the AS5600 12-Bit Programmable Contactless Potentiometer over I2C. This is a fork of dwm_pico_as5600. All functions are originally made by dancesWithMachines. This fork was meant to give me more control over the init function. This library is an INTERFACE CMake library.
Contents:
Using library is self explanatory. There is no documentation, but all the functions have descriptions for ease of use.
Any modern IDE should be capable of displaying them. For full list of functions study header file.

The code also comes with example file showing how to set up as5600 and use some of the functions.
You can find prebuilt example in "Releases" section under this repo if you just want to test the sensor.
To build example:
- Edit
PICO_SDK_PATHinCMakeLists.txt. - Create
builddirectory and access it. - From inside the directory run
cmake ..to configure and thenmaketo compile.
If compilation was successful as5600_example.uf2 binary file should be present in build directory.
Pi Pico can now be connected in flash mode and said file copied into it.
To test the example as5600 should be connected to default I2C pins. Those are GP4 for SDA and GP5 for SCL.
Image source: https://www.raspberrypi.com/documentation/microcontrollers/images/pico-pinout.svg
To test as5600 a test rig can be used. Testing by holding magnet directly in hand is discouraged.
Example prints messages via USB or UART. To receive messages a serial monitor like Minicom might be needed, but Arduino IDE's or VS Code's build ins should also do. Monitor should respect carriage return (in VS Code this is called terminal mode) for messages to display properly.
To embed library into a project, one can simply copy "lib/pico_as5600" directory from the repository.
CMakeLists.txt of target project needs to be modified to make use of the library.
In order for the library to be regocnized, to the project CMakeLists.txt add the following line:
add_subdirectory(lib/pico_as5600)
In the same CMakeLists.txt, add pico_as5600 to target_link_libraries. This is the same as with any of the Pico SDK hardware libraries.
Add #include "as5600.h" to project main source file to expose library functions.
For reference, check this repository's CMakeLists.txt file.
To test as5600 sensor, test rig can be downloaded and printed.
All necessary files can be found here: https://www.thingiverse.com/thing:6514317
To learn more about as5600 itself check product document: https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf
This source code is released under BSD-3 license.
Check LICENSE file for full license agreement.
Check COPYING for 3rd party licenses.
