Minimum effort to control a brushless motor

Having recieved multiple requests for source code and software used regarding a youtube video I made about controlling a brushless motor with an Arduino, I finally got around to putting this extra information somewhere. You can copy paste the code below or you can download the ino file Here

To send key presses from the computer to the arduino I used the Bray++ terminal, you can find it here. You can also use the Serial Monitor built into the Arduino IDE, or any other COM/Serial tool. Using the sketch as it is, the "0" key speeds the motor up, any other key slows it down.

I have a few projects in mind that will require controlling a brushless motor and my intention is to wire push buttons to two digital inputs on the Arduino to control speed up and down rather than have a PC connected over the serial port. I only used the serial port as it was more convenient for testing at the time.

#include <Servo.h>
Servo myservo;
int value = 59;
int val = 0;

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);
  delay(1);
  myservo.write(10);
  delay(5000);
}

void loop()
{
  while(Serial.available()>0)
  {
    if (Serial.read() == '0')
    {
      value +=2;
    }
    else
    {
      value-=2;
    }
    Serial.println(value);
  }
  myservo.write(value);
}