How to write library for sensor

Hi everyone,
I'm having a project about humidity sensor with new material. So i want to write library for new sensor, i refered some library for dht11/dht22/hr202l...but don't know how to write and build equations by code.
So, Can you direct me how to build and if you have a book or document about it, share me, please!!!
(Sorry my poor English, i 'll try to learn Eng better)

Here's a starting point.

Sounds like you need to start at the very beginning.
For a book, try this one.