Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. void loop()
  2.  
  3. volt = 0;
  4. for(int i=0; i<800; i++)
  5. {
  6. volt += ((float)analogRead(sensorPin)/1023)*5;
  7. }
  8. volt = volt/800;
  9. volt = round_to_dp(volt,1);
  10. if(volt < 2.5){
  11. ntu = 3000;
  12. }else{
  13. ntu = -1120.4*square(volt)+5742.3*volt-4353.8;
  14. }
  15. lcd.clear();
  16. lcd.setCursor(0,0);
  17. lcd.print(volt);
  18. lcd.print(" V");
  19.  
  20. lcd.setCursor(0,1);
  21. lcd.print(ntu);
  22. lcd.print(" NTU");
  23. delay(10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement