Sound measurements and electronic relays
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi i want to make a clap on and off light using an arduino board and writing code in MATLAB. while its fairly simple in Arduino im not sure how to write and include a relay in matlab. if someone can help me write this i would appreciate it.
댓글 수: 0
답변 (1개)
Pankhuri Kasliwal
2020년 11월 25일
Hello,
You will need to setup Hardware Support Package for MATLAB.
You can do so in Environment > Add-Ons > Get Hardware Support Packages > MATLAB Support Package for Arduino Hardware.
After installing the support package for MATLAB, we need to check if it has been installed properly or not. You can do so by connecting Arduino to your system and typing the following command in MATLAB command window. If connected successfully, MATLAB will then display the properties of the Arduino board connected to your system.
a = arduino()
Code for controlling LEDs using MATLAB and Arduino is as follows :
%create an object of arduino
a = arduino()
%blinking led for 5 secs
for i=1:5
writeDigitalPin(a,'D10',1);
pause(0.5);
wrteDigitalPin(a,'D10',0);
pause(0.5);
end
clear a
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!