참고
http://cafe.naver.com/arduinostory/12721
http://whwodud98.blog.me/50173201374
아두이노
CDS값 출력
int a=A4;
void setup() {
Serial.begin(9600);
}
void loop() {
int ab=analogRead(a);
Serial.println(ab);
delay(50);
}
MATHLAB에서
clc
delete(instrfindall)
s2=serial('COM3');
fopen(s2);
time =0;
for i=1:10000
time = time +1;
a =str2double(fscanf(s2));
plot(time,a,'*');
xlim([0 1000]);
hold on;
drawnow;
end
fclose(s2)
delete(instrfindall)
[출처] 아두이노 + 매트랩(matlab) 실시간 그래프 그리기|작성자 자유전자