De War Badge
Actuele versie: http://fablabamersfoort.nl/en/book/control-processing

Control by Processing

By peteruithoven. Last update on 24 Aug 2013.

From Inkscape, save as *.hpgl. And open it using the following Processing script: 

import processing.serial.*;
Serial serial;
volatile String path = "-";

void setup() {
  size(400,150);  
  println(Serial.list());
  //String portName = Serial.list()[0];
 serial = new Serial(this, "/dev/tty.usbserial-A800dpmc", 9600);
}

void mousePressed() {
 selectInput("Select *.hpgl file:", "fileSelected");
}

void keyPressed() {
  selectInput("Select *.hpgl file:", "fileSelected");
}

void draw() {
  background(220,220,220);
  fill(0);
  text("Click anywhere or press any button to open file",50,75);
  if(path != "-") {
    String lines[] = loadStrings(path);
    println(lines.length); 
    for (int i = 0; i < lines.length; i++) { 
      println(lines[i]);
      serial.write(lines[i]);
    }
    serial.write("Ec%0A;EcE;");
    path = "-";
  }
}

void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getAbsolutePath());
    path = selection.getAbsolutePath(); 
  }
}

Comments

Actually, we can use our customized code in Drupal, as it is the best cream which works the way we want. When I used to work for an rushessay review writing service. l then I gained experience on Drupal CRM and created some of my own add-ons. Soon, I will start my own online services on Drupal as it is the best service that users can quickly adapt and use and it is user-friendly.