Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Arduino Tutorial - How to use a Soil Hygrometer Module
- Dev: Michalis Vasilakis // Date: 18/05/2016 // www.ardumotive.com */
- #include <SoftwareSerial.h>
- SoftwareSerial BTserial(10, 11); // RX | TX
- //Constants
- const int hygrometer = A0; //Hygrometer sensor analog pin output at pin A0 of Arduino
- //Variables
- int value;
- void setup(){
- BTserial.begin(9600);
- }
- void loop(){
- // When the plant is watered well the sensor will read a value 380~400, I will keep the 400
- // value but if you want you can change it below.
- value = analogRead(hygrometer); //Read analog value
- BTserial.print("Soil humidity: ");
- BTserial.print(value);
- BTserial.println('%');
- delay(20); //Read every 2 sec.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement