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

조회 수: 3 (최근 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일
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 CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by