Problem in interfacing Arduino with Matlab GUI.

1 view (last 30 days)
hello! i am interfacing Arduino Mega 2560 with matlab, i have to control DC Motor speed using Matlab GUI by PWM technique, but its not working when i use analogRead/Write command. this shows error of "Undefined analogRead/Write..." and it is defined already... (while using digitalRead/Write command, it works. only problem in analog) Here is the Code.
clear a;
global a;
a= arduino('COM1')
a.pinMode(7,'output');
a.pinMode(6,'output');
a.pinMode(5,'output');
double av;
av=a.analogRead(7);
av=(av/1023)*255;
a.analogWrite(7,av);
a.digitalWrite(6,1);
a.digitalWrite(5,0);
Can anyone help me please. Thanks.

Answers (0)

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!