Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // www.jbcse.com
- import processing.serial.*;
- Serial myPort; // Create object from Serial class
- int x = 0;
- int y = 0;
- void setup(){
- size(320, 240);
- println((Object)Serial.list());
- String portName = Serial.list()[1];
- myPort = new Serial(this, portName, 460800);
- }
- void draw(){
- while ( myPort.available() > 0) { // If data is available,
- set(x, y, color((byte)(myPort.read()) & 0xFF));
- x++;
- if(x == 320){
- x = 0;
- y++;
- if (y == 240){
- y = 0;
- background(127);
- }
- }
- }
- }
- void keyPressed(){
- if (key == 's' || key == 'S')
- saveFrame("frame-####.bmp");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement