Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal_I2C.h>
- #include <Wire.h>
- LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
- unsigned long Tempo1;
- unsigned long Tempo2;
- byte Flag1 = 0;
- byte Flag2 = 1;
- //---------------------
- void setup()
- {
- lcd.begin (16, 2);
- // Serial.begin(9600);
- }
- //---------------------
- void loop()
- {
- if (Flag1 == 0)
- {
- if ((millis() - Tempo1) > 3000)
- {
- Flag1 = 1;
- Flag2 = 0;
- Troca1();
- Tempo2 = millis();
- }
- }
- if (Flag2 == 0)
- {
- if ((millis() - Tempo2) > 3000)
- {
- Flag1 = 0;
- Flag2 = 1;
- Troca2();
- Tempo1 = millis();
- }
- }
- }
- //---------------------
- void Troca1()
- {
- lcd.clear();
- lcd.setBacklight (HIGH);
- lcd.setCursor (0, 0);
- lcd.print ("Relogio");
- // delay (3000);
- // Serial.println("Troca1");
- }
- //---------------------
- void Troca2()
- {
- lcd.clear();
- lcd.setCursor (0, 1);
- lcd.print ("DS18B20");
- // delay (3000);
- // Serial.println("Troca2");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement