Magnet sensor sweep code

Where did you find the source code using that library?
Use the library manager to Install the library.