Advertisement
ShamelessName

Processing-unsuccessful; white screen

Feb 1st, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. import processing.serial.*;
  2.  
  3. PFont Consolas;
  4. String systMessage="";
  5. char confChar=7;
  6. Serial commsPort;
  7. int avIndex=1;
  8. int indent=25;
  9. int largeIndent=120;
  10. int scanDelay=690;
  11. int time;
  12. int wait=690;
  13. boolean selectionComplete=false;
  14. boolean displayDefaultScanMsg=true;
  15.  
  16. void setup()
  17. {
  18.   size(800,600);
  19.   Consolas=createFont("Consolas",17,true);
  20.   background(0);
  21. }
  22.  
  23. void draw()
  24. {
  25.   time=millis();
  26.   commsPort=new Serial(this,Serial.list()[avIndex],38400);
  27.   while(displayDefaultScanMsg==true)
  28.   {
  29.     text("Scanning...",largeIndent,40);
  30.   }
  31.   text(systMessage+(frameCount/10%2==0?"_":""),largeIndent,60);
  32.   delay(40);
  33.   portSelect();
  34. }
  35.  
  36.   void portSelect()
  37.   {
  38.     if(millis()-time>=wait)
  39.     {
  40.       for(displayDefaultScanMsg=true; commsPort.available()<=0; avIndex++)
  41.       {
  42.         for(displayDefaultScanMsg=false; commsPort.read()!=confChar; avIndex++)
  43.         {
  44.           commsPort.bufferUntil(confChar);
  45.           systMessage="Selection complete!";
  46.           commsPort=new Serial(this,Serial.list()[avIndex],38400);
  47.           commsPort.write(confChar);
  48.           selectionComplete=true;
  49.         }
  50.       }
  51.     }
  52.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement