J 창고

[Arduino] Mathlab과 연동 본문

컴퓨터/Firmware

[Arduino] Mathlab과 연동

JSFamily 2013. 11. 23. 14:38


참고


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) 


Comments