Advertisement
coltonspastebin

Water Sensor with LED

Dec 18th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. const int watersensor = A0;
  2. const int led = 5;
  3. int readValue = 0;
  4. int MinVal = 1000;
  5. int MaxVal = 0;
  6.  
  7.  
  8. void setup()
  9. {
  10. pinMode (watersensor, INPUT);
  11. pinMode (led, OUTPUT);
  12. Serial.begin (9600);
  13.  
  14.  
  15. }
  16.  
  17. void loop()
  18. {
  19. readValue = analogRead (watersensor);
  20. Serial.println (readValue);
  21. readValue = map(readValue, 0,65, 0, 255);
  22. analogWrite (led, readValue);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement