top of page

Processing Code

import processing.serial.*;
Serial port;

void setup(){
  port=new Serial(this,"COM10",9600);
  size(600,200);
  background(255);
}

void draw(){
  fill(0,200,612);
  rect(50,50,100,100,20);
  rect(250,50,100,100,20);
  rect(450,50,100,100,20);
  textSize(16);
  fill(255);
  text("FOOD", 60, 105);
  text("MANAGEMENT", 260, 105);
  text("SECURITY", 475, 105);
}

void mouseClicked(){
  if((mouseX>=50)&(mouseX<=150)&(mouseY>=50)&(mouseY<=150))
  {
    println("FOOD");
    port.write("a");
  }
  else if((mouseX>=250)&(mouseX<=350)&(mouseY>=50)&(mouseY<=150))
  {
    println("MANAGEMENT");
    port.write("b");
  }
  else if((mouseX>=450)&(mouseX<=550)&(mouseY>=50)&(mouseY<=150))
  {
    println("SECURITY");
    port.write("c");
  }
}

bottom of page