Nie chcąc zakładać nowego tematu prosiłbym o pomoc w dodaniu pewnej komendy do skeczu . Chodzi mi o to aby po przekroczeniu zadanej temperatur załączał się na pięć minut buzzer . Konkretnie jakby ktoś nie czytał wcześniejszych postów , skecz jest taki :
Kod:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C lcd(0x26, 2, 1, 0, 4, 5, 6, 7);
LiquidCrystal_I2C lcd2(0x27, 2, 1, 0, 4, 5, 6, 7);
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress P1 = { 0x28, 0xFF, 0xDF, 0x6E, 0x81, 0x15, 0x1, 0x78 };
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);
}
void loop() {
if ( (millis()/1000) < 20 )digitalWrite(3,HIGH);else digitalWrite(3,LOW);
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 chciałbym aby po przekroczeniu zadanej temperatury przez pięc minut załączał się buzer z takim fragmentem skecza :
Kod:
void setup() {
pinMode(A5, OUTPUT);
}
void loop() {
digitalWrite(A5, LOW);
delay(1000);
digitalWrite(A5, HIGH);
delay(1000);
}
Bardzo proszę o pomoc bo nie udało mi się wsadzić poprawnie tego kawałka do skecza .