source: t29-www/de-v6/lernprojekte/arduino-projekt-programme/fax_v1_1.pde.txt @ 262

Last change on this file since 262 was 262, checked in by sven, 12 years ago

Added svn:keywords = Id Property to de-v6, en-v6, lib. and ignore all files in shared/cache.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1import processing.serial.*;
2Serial serialPort;
3
4boolean finished=false;
5int scal=1;
6int kx=630/scal;
7int ky=0;
8float yScal=2;
9
10int verzoeger=0;
11
12
13
14void setup(){
15size(kx,900);
16noStroke();
17println(Serial.list());
18//serialPort = new Serial(this, Serial.list()[0], 9600); // Fuer Mac-User
19serialPort = new Serial(this, Serial.list()[Serial.list().length-1], 115200); // Fuer PC-User
20}
21
22void draw(){
23
24}
25
26void serialEvent(Serial serialPort) {
27  if (kx>0) {
28    String dataString = serialPort.readString();
29    println(dataString);
30    if (dataString != null) {
31      for(int i=0; i<dataString.length(); i++){
32        if(dataString.charAt(i)==48){
33          fill(255);
34          rect(kx*scal,ky*scal*yScal,scal,scal*yScal);
35          ky++;
36        }else if(dataString.charAt(i)==49){
37          fill(0);
38          rect(kx*scal,ky*scal*yScal,scal,scal*yScal);
39          ky++;
40        }else if(dataString.charAt(i)==50){
41          if(ky>300){
42            ky=0;
43            kx--;
44          }
45        }
46      }
47    }
48  }else if(!finished){
49    finished=true;
50    saveFrame("Scan#000003.jpg");
51  }
52}
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License