Processing program to control laserScannerControl_FRDMK64F as a "laser mouse"
import processing.serial.*;
Serial myPort; Create object from Serial class
void setup(){ size(800, 800); frameRate(240);
String portName = Serial.list()[0]; myPort = new Serial(this, "COM12" , 115200);
}
void draw(){ background(0); fill(0,20); rect(0,0,width, height); fill(255,0,0); ellipse(mouseX, mouseY, 10,10); }
void mouseMoved(){ int _x = int(1.0*mouseX/width*4095); int _y = int(1.0*mouseY/height*4095);
myPort.write(_x+""); myPort.write("X"); myPort.write(_y+""); myPort.write("Y"); println(mouseY+"\t"+mouseX);
}
2 comments on Processing program to control laserScannerControl_FRDMK64F as a "laser mouse" :
Please log in to post comments.