Generate PWM signal with specified voltage on digital pin
Specify digital pin 5 on Arduino hardware to have 3 volts.
a = arduino(); writePWMVoltage(a,'D5',3);
a— Arduino hardware connection
Arduino hardware connection
arduino, specified as an object.
pin— Digital pin number
Digital pin number on the physical hardware, specified as a character vector.
voltage— Voltage of the digital pin
Voltage of digital pin’s PWM specified as number between
Check your hardware data sheet for accepted voltage ranges. For example, Arduino Uno accepts 0 – 5
V and Arduino Due accepts
writePWMVoltage in a MATLAB® Function block with the Simulink® Support Package for Arduino Hardware to generate code that can be deployed on Arduino Hardware.
Configure the Arduino peripherals to the appropriate mode using
configurePin before using
writePWMVoltage in the MATLAB Function