need help making a loop URGENT

조회 수: 2 (최근 30일)
Payaam Khalid
Payaam Khalid 2022년 12월 6일
댓글: Jan 2022년 12월 6일
if x>=3.3
disp('signal recevied soil is dry time to water')
writeDigitalPin(a,'D2',1);pause(0.2);writeDigitalPin(a,'D2',0);
elseif x>=2.9
disp('signal received soil is wet but not wet enough time to water')
writeDigitalPin(a,'D2',1);pause(0.2);writeDigitalPin(a,'D2',0);
else
disp('signal received soil is wet')
end
i have a moisture sensor the value of the sensor is x i have a water pump that turns on if the x>=3.3 or when x>=2.9 the x value well decrease the x value i want to make a loop that keeps running this if statement until the x value is <2.9 how do i do it
thanks in advance
  댓글 수: 2
Payaam Khalid
Payaam Khalid 2022년 12월 6일
편집: Payaam Khalid 2022년 12월 6일
i meant to say the pump well decrease the x value the pump is the writedigitalpin(a,'D2')
Jan
Jan 2022년 12월 6일
Do not:
  1. Use words like "urgent" or "important" in your subject line

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

답변 (1개)

Florian Bidaud
Florian Bidaud 2022년 12월 6일
while x>= 2.9
% run your script
end

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by