How do I program a servo to respond to two different buttons on the VEX Controller?

4 ビュー (過去 30 日間)
How do I program a servo to respond to two different buttons on the VEX Controller such that one button turns it right and the other one turns it left?

回答 (1 件)

MathWorks Student Competitions Team
MathWorks Student Competitions Team 2015 年 9 月 11 日
編集済み: MathWorks Student Competitions Team 2015 年 9 月 11 日
Above is a screenshot of an example model on how to achieve this behavior.
Typically, you would try to use two servo blocks with the same port number to respond to two different Gamepad Button blocks, but Simulink (in R2015a and R2015b) would error out that you cannot have two motor blocks linked to the same port (as shown below).
Thus the best possible workaround is to use an Add block to combine the values from the two Button blocks and sent them as input to the Servo block (as shown in the first image). This way it receives either 127, -127 or 0 at any given time. Note that the summation will, however, result in a 0 if both buttons are pressed at any given time though. So, the driver had to be careful about not pressing both buttons at the same time.
The above error message in Simulink, when two motor/servo blocks are lined to the same port, will be removed in a future release of the VEX Cortex Support Package and thus you will be able to use duplicates of blocks in your Simulink models.

カテゴリ

Help Center および File ExchangeRobotics についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by