need help creating a loop URGENT

1 vue (au cours des 30 derniers jours)
Payaam Khalid
Payaam Khalid le 6 Déc 2022
Réponse apportée : KSSV le 6 Déc 2022
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
how do i make a loop that keeps running through this if statement until the value of x is <2.9

Réponses (1)

KSSV
KSSV le 6 Déc 2022
for x = 0:0.1:5
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
end
signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet signal received soil is wet
signal received soil is wet but not wet enough time to water
Unrecognized function or variable 'a'.

Catégories

En savoir plus sur Agriculture dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by