Servo library based on Timer instead of PWM. Fork of original https://os.mbed.com/users/jdenkers/code/Servo/ and modified for compatibility with MbedOS6+
Diff: Servo.h
- Revision:
- 2:2f6d7872d6f3
- Parent:
- 1:352133517ccc
--- a/Servo.h Sun Oct 17 13:34:19 2010 +0000 +++ b/Servo.h Fri Jun 10 04:22:15 2022 +0000 @@ -1,5 +1,6 @@ /* mbed Servo Library without using PWM pins * Copyright (c) 2010 Jasper Denkers + * Copyright (c) 2022 Jan Kamidra * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,8 +21,8 @@ * THE SOFTWARE. */ -#ifndef MBED_SERVO_H -#define MBED_SERVO_H +#ifndef SERVO_H +#define SERVO_H #include "mbed.h" @@ -40,11 +41,11 @@ * while(1) { * for (int pos = 1000; pos < 2000; pos += 25) { * Servo1.SetPosition(pos); - * wait_ms(20); + * thread_sleep_for(20); * } * for (int pos = 2000; pos > 1000; pos -= 25) { * Servo1.SetPosition(pos); - * wait_ms(20); + * thread_sleep_for(20); * } * } * @endcode