Advertisement
Jorge_moises

Código simples com I2C e DS18B20

Aug 9th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <LiquidCrystal_I2C.h>
  2. #include <Wire.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
  5.  
  6. unsigned long Tempo;
  7. unsigned long Tempo2;
  8.  
  9. void setup(){
  10.   lcd.begin (16,2);
  11. }
  12. void loop(){
  13.   if ((millis() - Tempo) > 3000){
  14.   Troca();
  15.   Tempo = millis();
  16.   }
  17.   if ((millis() - Tempo2) > 3000){
  18.   Troca2();
  19.   Tempo2 = millis();
  20.   }
  21.  }
  22. void Troca(){
  23.   lcd.setBacklight (HIGH);
  24.   lcd.setCursor (0,0);
  25.   lcd.print ("Relogio");
  26.   delay (3000);
  27.   lcd.clear();
  28.  }
  29.  
  30. void Troca2(){
  31.   lcd.setCursor (0,1);
  32.   lcd.print ("DS18B20");
  33.   delay (3000);
  34.   lcd.clear();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement