Error C99

1 reply [Last post]
AliBaba
AliBaba's picture
Title: NooBot
Joined: 01/08/2016
Posts:
BotPoints: 3
User offline. Last seen 7 years 20 weeks ago.

In this code to test servos I get an error for the "sleep" function.

The error is: "warning: implicit declaration of function 'sleep' is invalid in C99.
What does that error refer to ??

int main() {
printf("Powering servo to its center position\n");
set_servo_position(3, 1000);
enable_servos();

sleep(4);

printf("Sending servo to position 200\n");
set_servo_position(3, 200);

sleep(4);

printf("Sending servo to position 1800\n");
set_servo_position(3, 1800);

sleep(4);

printf("Turning servos off\n");
disable_servos();
}

DinaHaines
Title: NooBot
Joined: 04/25/2017
Posts:
BotPoints: 2
User offline. Last seen 6 years 5 weeks ago.

sleep is a non-standard function.
On UNIX, you shall include .
On MS-Windows, Sleep is rather from .
In every case, check the documentation.