dear developers,
I want add two servos to the CF2 and now I don't know how to control them to rotate by a controller. Can you help me find the controller's code and alter it?
thanks very much
thanks for your reply, and I have uploaded the servedeck.c program and add "PROJ_OBJ_CF2 += servodeck.o" to the Makefile. Then I connect the lines to the UAV, but the servo have no response. Can you tell me what should I do to control the servo work?
You also need to make sure that the deck driver gets actually loaded. Copy config.mk.example to config.mk (in crazyflie-firmware/blob/master/tools/make/). Then, add "CFLAGS += -DDECK_FORCE=bcServo" and recompile (you might need to do a clean build).
If your driver is accessible as a parameter you can modify the parameter value in the param tab of the client. This is more of a debug mode though.
Depending of how you want to control your servo the best is to run the client from its source code, find an existing functionality that matches what you want to do and dig in the code to find out how it is implemented. For example the client has functionalities to change the ledring color using a gamepad button, if you want to move the servo on a gamepad button you can look at the code implementing that and modify it for your needs.
If you tell us in a bit more details what functionality you want to implement in the client we can give you some pointers.
The driver exposes the PWM config (frequency and ratio) as parameters, see https://github.com/USC-ACTLab/crazyflie ... #L162-L165. Thus, you can use the parameter tab to change the settings. As arnaud said, any more high-level behavior might need some code changes.
thanks you very much,I want realize a functionality that two servos rotate certain degree between -45° and 45 ° when I press a gamepad's button, two servos stop till I press the button again. I don't know where and how to change the client code...
Either works. The main challenge is to find another available pin that can do PWM in HW. The driver itself just configures the pin accordingly. I would suggest starting reading the documentation of the STM32, and trying to understand the existing servo code (you can ask specific questions here of course).