How can I resolve the issue where Simulink fails to read a limit switch input from my Arduino, even though the wiring is correct and the limit switch works in the Arduino IDE?

1 回表示 (過去 30 日間)
Aisyah
Aisyah 2023 年 10 月 19 日
回答済み: Vidip 2023 年 11 月 23 日
hey, do you by any chance understand why my simulink won't read a limitswitch input from my arduino? like i try pressing it down so it will give "1" signal but the simulink did not read that. how to fix it?
i check if the wiring and everything else is correct and it is. i also tried using arduino IDE and the limitswitch works fine. what should i do?

回答 (1 件)

Vidip
Vidip 2023 年 11 月 23 日
I understand that your Arduino setup and limit switch work correctly when tested using the Arduino IDE, but the same setup doesn't seem to work in Simulink. You can try out below steps and if it still doesn’t fix the issue then more information would be required regarding the model:
  1. Review the Arduino code that is reading the limit switch input. Make sure that the code is correctly reading the digital input pin connected to the limit switch. Verify that the Arduino code is sending the correct signal to Simulink via the serial port. You can use the Serial Monitor in the Arduino IDE to check the output.
  2. Use the "Digital Input" block in Simulink to directly read the state of the pin where the limit switch is connected. This will help verify if the Simulink model is correctly configured.
For further information, refer to the documentation links below:

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by