delay() problem

I´m stuck with a wierd problem. My delay isn´t delaying when it should.

#include <Servo.h>

Servo trigger; 

void setup() {
  trigger.attach(3);   
  
  digitalWrite(10,LOW);
  delay(10000);                       //Here is no delay
  trigger.write(90);
  delay(750);                          //The servo waits 10s here
  trigger.write(0);
  delay(750);
  digitalWrite(10,HIGH);
  
}

Please help, I´m lost.

Of course delay() works. Why do you think it is not?

Note that a servo might move upon startup. You should send a neutral or other position command right after attach(), so you know that the servo is properly adjusted.

But at the wrong position. The first 10s delay does nothing and the second 750ms delay goes for 10s. Also the digital write does nothing.

Also the digital write does nothing.

It turns off, then later on, the pull-up resistor for pin 10

It should turn on a relay which has worked before. But why are the delays shifted

Woodpeckerfpv:
It should turn on a relay which has worked before.

For that, it would have to be an output pin.

You have still not provided any evidence that delay() is not working.

Since you have no idea what the servo is going to do (especially if you are mistakenly trying to power it from the Arduino 5V, instead of from an independent servo power supply), you should test the delay function by turning on and off an LED instead.

The servo is powered by the 5v and every thing worked flawless untill I added the the line of code that activates the relay.

Which line activates the relay?

The servo is powered by the 5v

You will eventually destroy the Arduino doing that, guaranteed.

Use a 4xAA battery pack, or other 5-6V power supply capable of providing at least 1 Ampere, and connect the grounds.

digitalWrite(10, LOW);

thanks for the advice about the servo

That line turns off the input pin's pull-up resistor.
I've already mentioned this.

Pin 10 has to be GND to trigger the relay. The internet says thats the way to go

And how does that work, on an input pin?

The internet says thats the way to go

I love it!

I´ve read that an input/output pin set to LOW works as gnd. And it worked preveosly for me.

Previously, perhaps, you told it to be an output pin

Ok I got that fixed but the delays are still the wrong durations. The Relay activates and the servo at almost the same time

Let's see the code, and let's hear your observations and reasoning.

#include <Servo.h>

Servo trigger; 

void setup() {
  trigger.attach(3);  
  pinMode(10, OUTPUT); 
  
  digitalWrite(10,LOW);
  delay(10000);
  trigger.write(90);
  delay(750);
  trigger.write(0);
  delay(750);
  digitalWrite(10,HIGH);
  
}

void loop() {

}
  1. Relay activates
    imedeatly
    2.servo turns to 90°
    10s delay
    3.servo turns to 0°
    750ms delay
    4.relay deactivates