Sending data from processing to arduino

On Processing:

//Define your variables here
import processing.serial.*; //imports serial library
int Com=0; //Sets which Port from the list will be used.

void setup()
{
size(Width,Height);
frameRate(30);
blah; //whatever else you may need here.
blah;//whatever else you may need here
CPort = new Serial(this, Serial.list()[Com], 115200); //Define CPort and baud rate here.
SendOrderToArduino();
}

void draw()
{
blah; //Your things here.
blah;
blah;
}

void SendOrderToArduino()
{
if(you want motor to move left==true)
{
Order=5;
}
if(you want motor to move right==true)
{
Order=10;
}
CPort.write(order);
}

On Arduino:
void setup()
{
blah;
blah;
Serial.begin(115200); //begins serial Communication with computer at 115200 bps.
}

void loop()
{
CheckOrder();
}

void CheckOrder()
{
if(Serial.available()>0)
{
Order=Serial.read();
if(Order==5)
{
MoveMotorLeft();
}
if(Order==10)
{
MoveMotorRight();
}
Order=0;
}