필터 지우기
필터 지우기

readDigitalPin from raspberry PI problem

조회 수: 1 (최근 30일)
Sapir Zurist
Sapir Zurist 2021년 1월 9일
답변: Nagasai Bharat 2021년 1월 19일
Hi all :)
I connedted my Raspberry PI to MATLAB and I want to use its inputs and outputs.
I defined:
configurePin(r,25,'DigitalOutput') -> the output is lamp
configurePin(r,19,'DigitalInput') -> the input is sensor that located opposite to the lamp
writeDigitalPin(r,25,1) -> lighting the lamp
readDigitalPin(r,19) -> read the value of the sensor
The goal is that the reading value from the sensor (0/1) will be changed according to the light - if the sensor see the light or if something is hiding the light.
The problem is that when I lighting the lamp and I try to read the value of readDigitalPin(r,19) it returns me the value "0", and when I cover the lamp, it also returns me the value "0" instead of "1" in one of the cases...
Did somebody knows or can think where is the problem?

답변 (1개)

Nagasai Bharat
Nagasai Bharat 2021년 1월 19일
Hi,
From my understanding there are few cases leading the issue.
  1. Pin 19 is not a available Digital Pin/GPIO
Read logical value from GPIO input pin - MATLAB readDigitalPin (mathworks.com) - This documentation should help you in finding the available pins.
2. The sensor may be too sensive to the lighting conditions. You can check the Pin with a Digital multimeter.
3. You can cross check the readDigitalPin with a switch and see if the value changes.

카테고리

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