MATLAB Arduino limit switch

3 visualizzazioni (ultimi 30 giorni)
Raguvaran Veerappan
Raguvaran Veerappan il 24 Feb 2018
Commentato: Georgi Rahnev il 10 Ott 2021
Hi, i would like to know how do I program the Arduino which controls a small DC motor. What I would like is for the motor to move in 1 direction and when the limit switch is hit the motor stops.
As of now, i cannot seem to get the for loop to work. I'm not sure if the read function is been sent to the loop. hope someone could help me. thanks in advance.
function rto_Callback(hObject, eventdata, handles)
global a
value=readDigitalPin(a, 'D11');
if (value==0)
writeDigitalPin(a, 'D8',1);
writeDigitalPin(a, 'D9',0);
else if (value==1)
writeDigitalPin(a, 'D8',0);
writeDigitalPin(a, 'D9',0);
% break
end
end
  15 Commenti
Yong Mun Pok
Yong Mun Pok il 12 Apr 2019
To Ragu,
Can you share the working code. It will really help me in doing my project. Otherwise, can send the relevant info the my email munson0829@gmail.com
Georgi Rahnev
Georgi Rahnev il 10 Ott 2021
I will be also thakful if you share. the_sooner@yahoo.com

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by