- To ensure the code runs once the digital pin becomes 1 and stops when it becomes 0, you can use a ‘Switch’ block. Connect the digital input pin to the ‘Switch’ block's condition input port.
- Inside the ‘Switch’ block, place the code or blocks responsible for the thermistor output.
- To trigger the thermistor output every time the digital pin goes from 0 to 1, you can use a ‘Memory’ block. Connect the digital input pin to the ‘Memory’ block's input port.
- Connect the output of the Memory block to the ‘Switch’ block's condition input port. This ensures that the ‘Switch’ block is only triggered when the digital pin transitions from 0 to 1.
- Connect the output of the ‘Switch’ block to the desired output block or code.
Triggering a system with a digital pin in Simulink
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to use a digital input pin to trigger the output of a thermistor. The thermistor code needs to run once the digital pin says 1 when it says 0 it needs to stop. It also needs to continue to trigger everytime the digital pin goes from 0 to 1. I tried using a triggered subsystem. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955460/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/955460/image.png)
댓글 수: 0
답변 (1개)
Aman Banthia
2023년 9월 18일
Hi Taylor,
I understand that you want to know a way to run the thermistor code only when the digital pin goes from 0 to 1.
Please refer to the following MATLAB Documentation to know more about the ‘Switch’ and ‘Memory’ blocks:
Hope the above solution helps you.
Best Regards,
Aman Banthia
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Modeling에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!