Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop()
- volt = 0;
- for(int i=0; i<800; i++)
- {
- volt += ((float)analogRead(sensorPin)/1023)*5;
- }
- volt = volt/800;
- volt = round_to_dp(volt,1);
- if(volt < 2.5){
- ntu = 3000;
- }else{
- ntu = -1120.4*square(volt)+5742.3*volt-4353.8;
- }
- lcd.clear();
- lcd.setCursor(0,0);
- lcd.print(volt);
- lcd.print(" V");
- lcd.setCursor(0,1);
- lcd.print(ntu);
- lcd.print(" NTU");
- delay(10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement