Servo stoping for a bit

Hello, im having a problem where when my servo that should constantly be running if above 30, stops for a split second and comes back.
I would be really thankfull if someone could help.

ESP 32
Android
Connected to hotspot
Blynk version: 2.27.29 android
Blynk Library: 1.0.0

#define BLYNK_PRINT Serial
#define SIGNAL_PIN_1 18
#define SIGNAL_PIN_2 19

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
#include <ESP32_Servo.h>



char auth[] = "iaJuNNZhb1S820_WlNfPIiKZ8JdMQ4VI";

char ssid[] = "PAP Igor";
char pass[] = "12345678";

#define DHTPIN 13

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
Servo myservo;
BlynkTimer timer;

int servoPin = 14;
int pos = 0;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void temperatura ()
{
  if (dht.readTemperature() > 30) {
    myservo.attach(servoPin);
    myservo.write(180);
  } else {
    myservo.detach();
  }

  if (dht.readTemperature() > 50) {
    Serial.println("Temperatura Alta");
    Blynk.notify("Temperatura Alta");
    delay(10000);
  } else {
    Serial.println("Temperatura Normal");
  }

}

void setup()
{
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

  dht.begin();

  myservo.attach(servoPin);

  timer.setInterval(1000L, sendSensor);
  timer.setInterval(100L, temperatura);

  pinMode(SIGNAL_PIN_1, INPUT);
  pinMode(SIGNAL_PIN_2, INPUT);
  pinMode(14, OUTPUT);


}

void loop()
{
  Blynk.run();
  timer.run();

  if (digitalRead(SIGNAL_PIN_1) == HIGH) {
    Serial.println("Movimento Patio");
    Blynk.notify("Movimento Patio");
    delay(10000);
  } else {
    Serial.println("Nada Patio");
  }

  if (digitalRead(SIGNAL_PIN_2) == HIGH) {
    Serial.println("Movimento Jardim");
    Blynk.notify("Movimento Jardim");
    delay(10000);
  } else {
    Serial.println("Nada Jardim");
  }

  delay(1000);

}

Topic closed because @Igor_Oliveira did not provide the required/requested information, and did not follow the guidelines about how to post code to the forum.

This topic will auto-delete in 24 hours.

Since @Blynk_Coeur was kind enough to format the OP’s code… I will reopen the topic, jump in and point out the obvious issue with the OP’s sketch…

A poorly written way to avoid flooding notifications…

Delay() in the void loop() :stuck_out_tongue:

1 Like

Im new to programming in general and what I normally do is search in google trying to find help from other users and basicly do trial and error.

But I wasn’t able to find a way to make so that the notifications don’t stack ontop of each other.

I have also fixed the problem with the servo now what im struggling with is the fact that I can’t get the button in the app to work together with my mini pir sensor.

I’d suggest that you go back to the beginning and provide ALL of the information that was requested when you initially created this topic.

This means absolutely nothing! There are two versions of the app, and each of those versions has iOS and Android versions.
We need a number, taken directly from the app.

We also need to know which Blynk library version you are using.

Pete.

I have now edit and added what was requested. But this post can be close now since the code is alot different then the one I posted. I will post a new one with everyone correctly later. Thank you

You should downgrade to 0.6.1

Please don’t do that. Use this topic instead.

Pete.