Advertisement
ZzzM8

Bluetoooth

May 23rd, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*  Arduino Tutorial - How to use a Soil Hygrometer Module
  2.   Dev: Michalis Vasilakis // Date: 18/05/2016 // www.ardumotive.com */
  3.  
  4. #include <SoftwareSerial.h>
  5.  
  6. SoftwareSerial BTserial(10, 11); // RX | TX
  7.  
  8.  
  9. //Constants
  10. const int hygrometer = A0;  //Hygrometer sensor analog pin output at pin A0 of Arduino
  11.  
  12. //Variables
  13. int value;
  14.  
  15. void setup(){
  16.  
  17.   BTserial.begin(9600);
  18. }
  19.  
  20. void loop(){
  21.  
  22.   // When the plant is watered well the sensor will read a value 380~400, I will keep the 400
  23.   // value but if you want you can change it below.
  24.  
  25.   value = analogRead(hygrometer);   //Read analog value
  26.  
  27.  
  28.   BTserial.print("Soil humidity: ");
  29.   BTserial.print(value);
  30.   BTserial.println('%');
  31.   delay(20); //Read every 2 sec.
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement