delay function does not appear on oscilloscope

Hello All,
I am trying to influence my servo motor with a delay function. I put the signal on the oscilloscope and I see the square wave but change on the scope when I change the delay value. Can anyone explain the delay function or how I can see it on the scope.
thank you.

// Controlling a servo position using a potentiometer (variable resistor) 
// by Michal Rinott <> 

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 
void setup() 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
void loop() 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 

That delay isn't part of the signal, it's between signals.

The physical movement takes ages, so the delay is to let the servo get there before we give it a new destination. Delay() is just a pause in the program.

The servo waveform will continue regardless of what your program does, you could have delay(three_weeks) and the result would be the same on your scope.

trying to influence my servo motor

Exactly what "influence" are you trying to achieve?


Set a pin as an o/p. Toggle this pin just before your delay. Use this to trigger your scope. Monitor the other o/p with your scope input probe.
|______________ Trigger signal o/p
<------------> Delay() will affect this time

| || |_ Servo o/p

Use a digital scope with lots of buffer space that you can scroll through.

Thanks a lot for your reply Some servo's do not seem to work very well with my arduino uno and that code . Al the older servo's work fine but some off the new ones that are called 'digital' have trouble . They do not keep up with potentiometer if it is moved fast . One servo I have trouble with is the hitec. hsr 5995 (that is suppose to be a real good one) That is why I was trying to play with the delay in the code and looking at the signal on the scope . I understand now - thanks to your info - that is not the right approach . I am starting to realise the trouble may be that (very expensive) hsr 5995 . Thanks loads again