writeDigitalPin question in matlab

2 ビュー (過去 30 日間)
Sapir Zurist
Sapir Zurist 2021 年 3 月 14 日
コメント済み: Walter Roberson 2021 年 3 月 14 日
Hi all,
I connected Rapberry PI to Fischertechnik robot model and I have a question about it -
I know that there is the command:
writeDigitalPin(r, 23, 1);
But, the robot have 2 opposite directions that it can be moved to each one of the motors...
So, how can I write in the code which one of the 2 directions I want?
Thank you!!

採用された回答

Walter Roberson
Walter Roberson 2021 年 3 月 14 日
You cannot. writeDigitalPin() does not support tri-state pins (left, off, right); it only supports binary (off, on) .
Systems with motors often use one of several systems:
  • quadrature encoding; https://cdn.sparkfun.com/datasheets/Robotics/How%20to%20use%20a%20quadrature%20encoder.pdf
  • separate pins for each direction --- this is less common and leads to questions about what should happen if both pins are active at the same time
  • analog signal in which negative indicates opposite direction
  • two bits grouped together that are together interpreted as a binary value that indicates direction number; this leads to questions about what to do with the 4th value. Sometimes two stop states are defined and gray encoding is used: 00 -> stop; 01 -> right; 11 -> stop; 10 -> left
  3 件のコメント
Image Analyst
Image Analyst 2021 年 3 月 14 日
I doubt he'd know that. I think you'd have to consult the manual for your motor (which we don't have).
Walter Roberson
Walter Roberson 2021 年 3 月 14 日
See the description from line 226 at https://github.com/CodaFi/FTKit/blob/master/fischertechnik/fischertechnik/ftapi.h
Each motor has two controlling outputs 0 to 7 for speed. One output for each direction. For reverse set the first output to 0 and a speed for the second output.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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