Chirp is a great little soil moisture sensor. This is a library for the Chirp soil moisture sensor. It supports reading Capacitance (soil moisture) and soil temperature. You can get Chirp on Tindie https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/ And read documentation on github https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/
Chirp.h@0:6164b94deb27, 2017-01-12 (annotated)
- Committer:
- Vlad
- Date:
- Thu Jan 12 22:01:43 2017 +0000
- Revision:
- 0:6164b94deb27
Chirp Library. ; https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/; https://github.com/Miceuz/i2c-moisture-sensor; Supports reading soil moisture and temperature.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vlad | 0:6164b94deb27 | 1 | |
Vlad | 0:6164b94deb27 | 2 | #ifndef MBED_CHIRP_H |
Vlad | 0:6164b94deb27 | 3 | #define MBED_CHIRP_H |
Vlad | 0:6164b94deb27 | 4 | |
Vlad | 0:6164b94deb27 | 5 | #include "mbed.h" |
Vlad | 0:6164b94deb27 | 6 | |
Vlad | 0:6164b94deb27 | 7 | //#define _DEBUG |
Vlad | 0:6164b94deb27 | 8 | #define DEFAULT_SLAVE_ADDRESS (0x20 << 1) |
Vlad | 0:6164b94deb27 | 9 | |
Vlad | 0:6164b94deb27 | 10 | |
Vlad | 0:6164b94deb27 | 11 | class Chirp |
Vlad | 0:6164b94deb27 | 12 | { |
Vlad | 0:6164b94deb27 | 13 | public: |
Vlad | 0:6164b94deb27 | 14 | Chirp(PinName sda, PinName sck, char slave_adr = DEFAULT_SLAVE_ADDRESS); |
Vlad | 0:6164b94deb27 | 15 | float getCapacitance(void); |
Vlad | 0:6164b94deb27 | 16 | float getTemperature(void); |
Vlad | 0:6164b94deb27 | 17 | |
Vlad | 0:6164b94deb27 | 18 | private: |
Vlad | 0:6164b94deb27 | 19 | |
Vlad | 0:6164b94deb27 | 20 | I2C *i2c_p; |
Vlad | 0:6164b94deb27 | 21 | I2C &i2c; |
Vlad | 0:6164b94deb27 | 22 | char address; |
Vlad | 0:6164b94deb27 | 23 | }; |
Vlad | 0:6164b94deb27 | 24 | |
Vlad | 0:6164b94deb27 | 25 | |
Vlad | 0:6164b94deb27 | 26 | |
Vlad | 0:6164b94deb27 | 27 | |
Vlad | 0:6164b94deb27 | 28 | #endif // MBED_CHIRP_H |