pull_up_down in Matlab

조회 수: 10 (최근 30일)
Sapir Zurist
Sapir Zurist 2021년 3월 22일
댓글: Christopher McCausland 2021년 3월 24일
Hi,
About the GPIO in raspberry pi - I need to enable the internal pull up resistor to read a 'high' value at the pin by default.
I see that in python you have the following command: GPIO.setup(PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Is there something similar in Matlab?

답변 (1개)

Christopher McCausland
Christopher McCausland 2021년 3월 22일
Hi Sapir,
In MATLAB there is a "configurePin" command which can enable the pull up resistor. Here is the link to the documentation.
In short it looks something link this;
a = arduino('COM4','Uno'); %Link to the arduino
configurePin(a,'D3','pullup'); % Configure the internal pull up on pin D3
Let me know if this helps you,
Christopher
  댓글 수: 3
Sapir Zurist
Sapir Zurist 2021년 3월 24일
I enable the pull up resistor through Python on the Raspberry itself and it works.
Christopher McCausland
Christopher McCausland 2021년 3월 24일
Hi Sapir,
My appologies, I clearly wasn't paying as much attention as I should have been.
I am not sure if this is avaliable as a command though it should be. However with some hardware tinkering we should be able to make this happen;
  1. When an RP boots the first eight GPIO's have pull-ups enabled and the rest have pull-downs enabled, you should be able to use this to your advantage.
  2. Add in additional resistors to the circuit in place of the internal pull ups
Both of these solotions are not ideal however should allow you to continue with your work in the mean time. I cannot think of why MATLAB wouldn't allow this functionality however looking at this forum and others many the same problem can be found as far back as 2017 with the documentation of 'mode' suggesting it isn't currently possiable.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Raspberry Pi Hardware에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by