How can I make a loop for sending a signal in form of step, using only Matlab and Arduino Mega 2560 (not Simulink nor step function itself)?

1 visualizzazione (ultimi 30 giorni)
Hi everyone
I'm working with arduino Mega 2560 and Matlab and I'm using the function "writePWMVoltage" for sending a specific voltage to outside.
My issue is the following situation:
I don't know how to make a loop for creating a "step" signal (without using the function of matlab itself, nor Simulink).
For example, I want to send a voltage of 2 volts since t = 0 to 30 seconds, and from the instant 31 second, send a voltage of 2.5 Volts (If you see, this is like a "step function")
I'm trying with the functions "for", "while", and I don't know how to get this thing, it appears some errors, I'm a amateur in programation.
Please help me.
Thank you so much for reading and answer me in advance.

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