http://yehnan.blogspot.tw/2014/02/arduino.html(程式碼)
接線---
調baud:115200
轉動旋鈕後數值會跟著增減
processing

import processing.serial.*;
Serial myPort;
void setup(){
size(500,500);
myPort=new Serial(this,"COM7",115200);
}
int x=0;
int lf=10;
void draw(){
background(0);
if(myPort.available()>0){
String now = myPort.readStringUntil(lf);
x=int(split(now,'\r')[0]);
println(now);
}
ellipse(width/2+x*20,height/2,100,100);
}
沒有留言:
張貼留言