• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Problem po dodaniu komend
#1
Witam
Mam zbudowany termometr czterokanałowy z obsługą 2 wyświetlaczy . Wszystko chodziło dobrze , lecz musiałem dodać wyzwalanie pinu cyfrowego po odpowiednim czasie :
Kod:
pinMode(3, OUTPUT);
digitalWrite(3, HIGH);
 delay(1800000 );
 digitalWrite(3, LOW);

Po wstawieniu tego do void setup wyświetlacze nie pokazują już niczego - tylko świecą . Gdzie popełniłem błąd ?
Program przed modyfikacją wyglądał tak:
Kod:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C  lcd(0x27, 2, 1, 0, 4, 5, 6, 7);
LiquidCrystal_I2C  lcd2(0x26, 2, 1, 0, 4, 5, 6, 7);

#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);




DeviceAddress P1 = { 0x28, 0xFF, 0xB6, 0x35, 0xB0, 0x15, 0x3, 0x1F };
DeviceAddress P2 = { 0x28, 0xFF, 0xF5, 0x31, 0xB1, 0x15, 0x1, 0xA1 };
DeviceAddress P3 = { 0x28, 0xFF, 0x42, 0x2F, 0xB0, 0x15, 0x3, 0x85 };
DeviceAddress P4 = { 0x28, 0xFF, 0xDE, 0x2F, 0xB1, 0x15, 0x1, 0x4 };

void setup()
{
 Serial.begin(9600);
 sensors.begin();
 Wire.begin();
 lcd.begin(16, 2);
 lcd2.begin(20,4);
 lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
 lcd.setBacklight(HIGH);
 lcd2.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
 lcd2.setBacklight(HIGH);
 

}
void loop() {
 sensors.requestTemperatures();
 
 int tempC1 = sensors.getTempC(P1);
 int tempC2 = sensors.getTempC(P2);
 int tempC3 = sensors.getTempC(P3);
 int tempC4 = sensors.getTempC(P4);

 lcd.setCursor (0, 0);
 lcd.write("PIEC ");
 lcd.print(tempC1, 1);
 lcd.write(byte(223));

 lcd.setCursor (9, 0);
 lcd.write("WYJ ");
 lcd.print(tempC2, 1);
 lcd.write(byte(223));

 lcd.setCursor (0, 1);
 lcd.write("POWR ");
 lcd.print(tempC3, 1);
 lcd.write(byte(223));

 lcd.setCursor (9, 1);
 lcd.write("MIE ");
 lcd.print(tempC4, 1);
 lcd.write(byte(223));

 

 
   
 sensors.requestTemperatures();{
     

 float tempC1 = sensors.getTempC(P1);
 float tempC2 = sensors.getTempC(P2);
 float tempC3 = sensors.getTempC(P3);
 float tempC4 = sensors.getTempC(P4);
 

 

 lcd2.setCursor (0, 0);
 lcd2.write("TEMP.PIEC    ");
 lcd2.print(tempC1, 1);
 lcd2.write(byte(223));
 
 lcd2.setCursor (0, 1);
 lcd2.write("WYJSCIE PIEC ");
 lcd2.print(tempC2, 1);
 lcd2.write(byte(223));

 lcd2.setCursor (0, 2);
 lcd2.write("POWROT WODY  ");
 lcd2.print(tempC3, 1);
 lcd2.write(byte(223));

 lcd2.setCursor (0, 3);
 lcd2.write("MIESZAJACY   ");
 lcd2.print(tempC4, 1);
 lcd2.write(byte(223));
}




   
}
A po modyfikacji , już nie działający wygląda tak

Kod:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C  lcd(0x27, 2, 1, 0, 4, 5, 6, 7);
LiquidCrystal_I2C  lcd2(0x26, 2, 1, 0, 4, 5, 6, 7);

#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);




DeviceAddress P1 = { 0x28, 0xFF, 0xB6, 0x35, 0xB0, 0x15, 0x3, 0x1F };
DeviceAddress P2 = { 0x28, 0xFF, 0xF5, 0x31, 0xB1, 0x15, 0x1, 0xA1 };
DeviceAddress P3 = { 0x28, 0xFF, 0x42, 0x2F, 0xB0, 0x15, 0x3, 0x85 };
DeviceAddress P4 = { 0x28, 0xFF, 0xDE, 0x2F, 0xB1, 0x15, 0x1, 0x4 };

void setup()
{
 Serial.begin(9600);
 sensors.begin();
 Wire.begin();
 lcd.begin(16, 2);
 lcd2.begin(20,4);
 lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
 lcd.setBacklight(HIGH);
 lcd2.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
 lcd2.setBacklight(HIGH);
 pinMode(3, OUTPUT);
digitalWrite(3, HIGH);
 delay(1800000 );
 digitalWrite(3, LOW);
 
}
void loop() {
 sensors.requestTemperatures();
 
 int tempC1 = sensors.getTempC(P1);
 int tempC2 = sensors.getTempC(P2);
 int tempC3 = sensors.getTempC(P3);
 int tempC4 = sensors.getTempC(P4);

 lcd.setCursor (0, 0);
 lcd.write("PIEC ");
 lcd.print(tempC1, 1);
 lcd.write(byte(223));

 lcd.setCursor (9, 0);
 lcd.write("WYJ ");
 lcd.print(tempC2, 1);
 lcd.write(byte(223));

 lcd.setCursor (0, 1);
 lcd.write("POWR ");
 lcd.print(tempC3, 1);
 lcd.write(byte(223));

 lcd.setCursor (9, 1);
 lcd.write("MIE ");
 lcd.print(tempC4, 1);
 lcd.write(byte(223));


 lcd2.setCursor (0, 0);
 lcd2.write("TEMP.PIEC    ");
 lcd2.print(tempC1, 1);
 lcd2.write(byte(223));
 
 lcd2.setCursor (0, 1);
 lcd2.write("WYJSCIE PIEC ");
 lcd2.print(tempC2, 1);
 lcd2.write(byte(223));

 lcd2.setCursor (0, 2);
 lcd2.write("POWROT WODY  ");
 lcd2.print(tempC3, 1);
 lcd2.write(byte(223));

 lcd2.setCursor (0, 3);
 lcd2.write("MIESZAJACY   ");
 lcd2.print(tempC4, 1);
 lcd2.write(byte(223));





   
}
 
Odpowiedź
  


Wiadomości w tym wątku
Problem po dodaniu komend - przez maniolx - 30-11-2016, 00:41
RE: Problem po dodaniu komend - przez Automatyk - 30-11-2016, 00:48
RE: Problem po dodaniu komend - przez maniolx - 30-11-2016, 01:12
RE: Problem po dodaniu komend - przez namok - 30-11-2016, 08:18
RE: Problem po dodaniu komend - przez JasQ - 30-11-2016, 08:28
RE: Problem po dodaniu komend - przez maniolx - 01-12-2016, 13:50
RE: Problem po dodaniu komend - przez namok - 01-12-2016, 17:23
RE: Problem po dodaniu komend - przez adix - 01-12-2016, 19:03
RE: Problem po dodaniu komend - przez JasQ - 01-12-2016, 22:45
RE: Problem po dodaniu komend - przez maniolx - 01-12-2016, 23:51
RE: Problem po dodaniu komend - przez JasQ - 02-12-2016, 18:14
RE: Problem po dodaniu komend - przez maniolx - 02-12-2016, 19:57
RE: Problem po dodaniu komend - przez piotr2393 - 03-12-2016, 19:17
RE: Problem po dodaniu komend - przez maniolx - 04-12-2016, 02:37
RE: Problem po dodaniu komend - przez piotr2393 - 04-12-2016, 14:18
RE: Problem po dodaniu komend - przez maniolx - 05-12-2016, 16:50
RE: Problem po dodaniu komend - przez krn78 - 05-12-2016, 13:09
RE: Problem po dodaniu komend - przez namok - 05-12-2016, 18:10
RE: Problem po dodaniu komend - przez maniolx - 05-12-2016, 18:55
RE: Problem po dodaniu komend - przez maniolx - 09-01-2017, 22:17
RE: Problem po dodaniu komend - przez namok - 10-01-2017, 10:07

Skocz do:


Przeglądający: 1 gości