MATLAB Arduino limit switch

3 visualizaciones (últimos 30 días)
Raguvaran Veerappan
Raguvaran Veerappan el 24 de Feb. de 2018
Comentada: Georgi Rahnev el 10 de Oct. de 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 comentarios
Yong Mun Pok
Yong Mun Pok el 12 de Abr. de 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 el 10 de Oct. de 2021
I will be also thakful if you share. the_sooner@yahoo.com

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by