PL:
Witam
Mam pytanie w sprawie zakłóceń.
Posiadam płytkę WEMOS D1 R2 oraz Blynk.
Na blynk mam dwa czujniki temperatury ONEWIRE (DS18B20) , przekaźnik dwukanałowy który daje sygnał do sterownika ( otwieranie i zamykanie bramy) oraz 3 diody “LED” na blynk które odczytują sygnał z krańcówek ( otwarta, furtka, zamknięta). Sygnał z krańcówek do Arduino przechodzi przez przekaźnik.
Mój problem polega na tym że jak mam podpięte do arduino krańcówki to mi się wiesza przy otwieraniu bramy.
ENG: ( translator google )
Hello
I have a question on the interference.
I have a plate WEMOS D1 R2 and Blynk.
I have two ONEWIRE temperature sensors (DS18B20), a two-channel relay that gives a signal to the controller (opening and closing the gate), and 3 LEDs on the gimbal that read the signal from the terminals (open, gate, closed). The signal from the Arduino terminals passes through the relay.
** My problem is that when I have the arduino hooked to the hook it hangs when opening the gate. **
> #include <SimpleTimer.h>
> #define BLYNK_PRINT Serial // Comment this out to disable prints and save space
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266.h>
> #include <OneWire.h>
> #include <DallasTemperature.h>
>
> #define ONE_WIRE_BUS 2 // This is the ESP8266 pin
> OneWire oneWire(ONE_WIRE_BUS);
> DallasTemperature sensors(&oneWire);
>
> DeviceAddress tempSensor1 = { .............. }; // Adres temperatury #1
> DeviceAddress tempSensor2 = { ...................... }; // Adres temperatury #2
> DeviceAddress tempSensor3 = { ............... }; // Adres temperatury #2
>
>
> char auth[] = ".........."; // Kod BLYNK
> char ssid[] = "........."; // Login WIFI
> char pass[] = ""; // Hasło WIFI
>
> SimpleTimer timer;
> int pin = D3; // Pin cyfrowy krancówka
> WidgetLED led1(V5); // Pin wirtualny krancowy
> int pin2 = D1; // Pin cyfrowy krancówka
> WidgetLED led2(V6); // Pin wirtualny krancowy
> int pin3 = D2; // Pin cyfrowy krancówka
> WidgetLED led3(V7); // Pin wirtualny krancowy
> int pin4 = D0; // Pin cyfrowy krancówka
> WidgetLED led4(V8); // Pin wirtualny krancowy
>
> int tempC1, tempC2, tempC3; // Variables for storing temperatures
> BLYNK_CONNECTED() {
> Blynk.syncAll();
> }
> void setup()
> {
> Serial.begin(9600);
> Blynk.begin(auth, ssid, pass);
>
> while (Blynk.connect() == false) {
> // Wait until connected
> }
>
> sensors.begin();
> timer.setInterval(1000L, brama1); //Sprawdzanie stanu
> timer.setInterval(1000L, brama2); //Sprawdzanie stanu
> timer.setInterval(1000L, brama3); //Sprawdzanie stanu
> timer.setInterval(1000L, brama4); //Sprawdzanie stanu
> sensors.setResolution(tempSensor1, 9); // More on resolutions: http://www.homautomation.org/2015/11/17/ds18b20-how-to-change-resolution-9101112-bits/
> sensors.setResolution(tempSensor2, 9);
> sensors.setResolution(tempSensor3, 9);
> // These timers are used so that data does not flood Blynk
> timer.setInterval(5000L, sendSensor1); // Czas pomiaru temperatury #1
> timer.setInterval(5000L, sendSensor2); // Czas pomiaru temperatury #2
> timer.setInterval(5000L, sendSensor3); // Czas pomiaru temperatury #2
> }
>
> void loop()
> {
> Blynk.run();
> timer.run();
> }
>
> void sendSensor1() {
> sensors.requestTemperatures(); // Polls the sensors
> tempC1 = sensors.getTempC(tempSensor1); // C - celsjusza / F - fahrenheita
>
> Blynk.virtualWrite(1, tempC1); // 1 Pin wirtualny
> }
>
> void sendSensor2()
> {
> sensors.requestTemperatures();
> tempC2 = sensors.getTempC(tempSensor2);
>
> Blynk.virtualWrite(2, tempC2); // 2 Pin wirtualny
> }
> void sendSensor3()
> {
> sensors.requestTemperatures();
> tempC3 = sensors.getTempC(tempSensor3);
>
> Blynk.virtualWrite(3, tempC3); // 3 Pin wirtualny
> }
> void brama1()
> {
> if(digitalRead(pin) == 1){
> led1.on();
> }
> else{
> led1.off();
> }
> }
> void brama2()
> {
> if(digitalRead(pin2) == 1){
> led2.on();
> }
> else{
> led2.off();
> }
> }
> void brama3()
> {
> if(digitalRead(pin3) == 1){
> led3.on();
> }
> else{
> led3.off();
> }
> }
> void brama4()
> {
> if(digitalRead(pin4) == 1){
> led4.on();
> }
> else{
> led4.off();
> }
> }