that_one_nigga_you_k

hoje

Oct 1st, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 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.   Serial.begin(9600);
  11. }
  12. void loop()
  13. {
  14.   val = analogRead(tempPin);
  15.   float cel = val * 0.48828125;
  16.   float farh = (cel*9)/5 + 32;
  17.  
  18.   /*lcd.print("gang = ");
  19.   lcd.print(cel);
  20.   lcd.print("*C");
  21.   delay(300);
  22.   lcd.clear();*/
  23.   Serial.print("temperatura: ");
  24.   Serial.print(cel);
  25.   Serial.println(" º");
  26.   delay(500);
  27.  
  28. if(cel>30){
  29.    analogWrite(13, 240);
  30.    digitalWrite(22, 0);
  31.    digitalWrite(23, 1);
  32. }
  33. else{
  34.    analogWrite(13, 0);
  35.    digitalWrite(22, 1);
  36.    digitalWrite(23, 1);
  37. }
  38.  
  39. /* uncomment this to get temperature in farenhite
  40. Serial.print("TEMPRATURE = ");
  41. Serial.print(farh);
  42. Serial.print("*F");
  43. Serial.println();
  44.  
  45.  
  46. */
  47. }
Add Comment
Please, Sign In to add comment