How to make a step function from 2 volts to 2.5 volts in matlab using Arduino? (without Simulink and step matlab function itself)
    9 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Jonathan Bijman
 el 28 de En. de 2019
  
    
    
    
    
    Respondida: Jonathan Bijman
 el 31 de En. de 2019
            Hi everyone
Recently I asked how can I make a step function with writePWMVoltage in arduino MEGA 2560 and matlab.
The idea is to pass from 2 volts to 2.5 volts. Here is my program:
clc
clear all
a = arduino;
writePWMVoltage(a,'D5',2);
for k = 1:1000
    writePWMVoltage(a,'D5',2);
   if k>=250
    writePWMVoltage(a,'D5',2.5);
   end
end 
When I do this, in some point the voltimeter sizes 2,23 volts before to reach 2.5 volts, and I need the function step (from 2 volts direct to 2,5 volts)
Can you help me please?
Thank you
0 comentarios
Respuesta aceptada
  Madhu Govindarajan
    
 el 28 de En. de 2019
        What if you changed your code to the following - 
clc
clear all
a = arduino;
writePWMVoltage(a,'D5',2);
for k = 1:1000
   if k>=250
    writePWMVoltage(a,'D5',2.5);
   else 
    writePWMVoltage(a,'D5',2);
   end
end 
0 comentarios
Más respuestas (1)
Ver también
Categorías
				Más información sobre Arduino Hardware en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

