Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.serial.*;
- PFont Consolas;
- String systMessage="";
- char confChar=7;
- Serial commsPort;
- int avIndex=1;
- int indent=25;
- int largeIndent=120;
- int scanDelay=690;
- int time;
- int wait=690;
- boolean selectionComplete=false;
- boolean displayDefaultScanMsg=true;
- void setup()
- {
- size(800,600);
- Consolas=createFont("Consolas",17,true);
- background(0);
- }
- void draw()
- {
- time=millis();
- commsPort=new Serial(this,Serial.list()[avIndex],38400);
- while(displayDefaultScanMsg==true)
- {
- text("Scanning...",largeIndent,40);
- }
- text(systMessage+(frameCount/10%2==0?"_":""),largeIndent,60);
- delay(40);
- portSelect();
- }
- void portSelect()
- {
- if(millis()-time>=wait)
- {
- for(displayDefaultScanMsg=true; commsPort.available()<=0; avIndex++)
- {
- for(displayDefaultScanMsg=false; commsPort.read()!=confChar; avIndex++)
- {
- commsPort.bufferUntil(confChar);
- systMessage="Selection complete!";
- commsPort=new Serial(this,Serial.list()[avIndex],38400);
- commsPort.write(confChar);
- selectionComplete=true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement