Advertisement
matat

Hygomètre YL-69

Jul 2nd, 2020
1,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Matat 2020 Youtube
  2.  
  3. int hygrometre = A0;    // pin de l'hygromètre
  4. float valeur = 0;
  5. float calcul;
  6. void setup() {
  7. Serial.begin(115200);
  8. }
  9.  
  10. void loop() {
  11.   // read the value from the sensor:
  12.   valeur = analogRead(hygrometre);
  13.   calcul = ((1-((valeur-510) /(1024-510)))*100);
  14. Serial.print(calcul);
  15. Serial.println("% d'humidité");
  16. delay(500);
  17. }
  18.  
  19. //510 min 1024
  20.  
  21. //5-7 minutes d'initialisation
  22.  
  23.  
  24. //vcc->5v
  25. //gnd->gnd
  26. //A0-> pin analogique de la carte
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement