磁铁、舵机、网页控制、通信协议
This commit is contained in:
1 parent
230ad1254a
commit
40ee976236
17 files changed
+1879
-32
No files matched your search
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file servo.h
|
||||
* @brief 180° PWM 舵机控制 (LEDC)
|
||||
*/
|
||||
|
||||
#ifndef SERVO_H
|
||||
#define SERVO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 初始化舵机 (50Hz PWM)
|
||||
* @param gpio PWM 输出引脚
|
||||
*/
|
||||
void servo_init(int gpio);
|
||||
|
||||
/**
|
||||
* @brief 设置舵机角度
|
||||
* @param angle 角度 0.0 ~ 180.0
|
||||
*/
|
||||
void servo_set_angle(float angle);
|
||||
|
||||
/**
|
||||
* @brief 设置舵机到上限位 (默认 180°)
|
||||
*/
|
||||
void servo_set_up(void);
|
||||
|
||||
/**
|
||||
* @brief 设置舵机到下限位 (默认 0°)
|
||||
*/
|
||||
void servo_set_down(void);
|
||||
|
||||
/**
|
||||
* @brief 自定义上下限位角度
|
||||
* @param up 上限位角度 (默认 180°)
|
||||
* @param down 下限位角度 (默认 0°)
|
||||
*/
|
||||
void servo_set_limits(float up, float down);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SERVO_H */
|
||||
Reference in new issue
Block a user