that_one_nigga_you_k

gang

Sep 28th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. int val;
  4. int tempPin = 15;
  5. LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
  6.  
  7. void setup() {
  8.   lcd.begin(16, 2);
  9.   lcd.setCursor(0,0);
  10. }
  11. void loop()
  12. {
  13.   val = analogRead(tempPin);
  14.   float cel = val * 0.48828125;
  15.   float farh = (cel*9)/5 + 32;
  16.  
  17.   lcd.print("gang = ");
  18.   lcd.print(cel);
  19.   lcd.print("*C");
  20.   delay(300);
  21.   lcd.clear();
  22.  
  23. if(cel>30){
  24.    analogWrite(13, 240);
  25.    digitalWrite(22, 1);
  26.    digitalWrite(23, 0);
  27. }
  28. else{
  29.    analogWrite(13, 0);
  30.    digitalWrite(22, 1);
  31.    digitalWrite(23, 1);
  32. }
  33.  
  34. /* uncomment this to get temperature in farenhite
  35. Serial.print("TEMPRATURE = ");
  36. Serial.print(farh);
  37. Serial.print("*F");
  38. Serial.println();
  39.  
  40.  
  41. */
  42. }
Add Comment
Please, Sign In to add comment