How can I send a pwm signal towards a motor with arduino in matlab

10 Ansichten (letzte 30 Tage)
Martijn Roks
Martijn Roks am 1 Jul. 2019
Kommentiert: Martijn Roks am 2 Jul. 2019
Hello,
How do I send a PWM signal towards my motor, so that I can control it's speed?
I tried to use analogwrite, because on arduino IDE I can use it to control the motor. But on Matlab I can't use analogWrite, because the command doesn't exist.
I tried to use writePWMDutyCycle, but I couldn't control the motor with it.
Could someone plz help me!
I have the following code (this is just one button for the gui and the other buttons have the same code:
% --- Executes on button press in Snelheid100_button.
function Snelheid100_button_Callback(hObject, eventdata, handles)
% hObject handle to Snelheid100_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA
a= arduino();
analogWrite(3,80);
clear a;

Antworten (1)

Toshinobu Shintai
Toshinobu Shintai am 2 Jul. 2019
Can you use 'writePWMVoltage' command?
Documentation is below.
  1 Kommentar
Martijn Roks
Martijn Roks am 2 Jul. 2019
I tried that but that isn't my thing and then I need to figure out which voltage output is die exact PWMsignal. So I prefer it to be with writePWMDutycycle

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by