Error Uploading code to Arduino

I actually want to upload a program to my Arduino Uno for making a BB-9E. Since I'm new to Arduino I can't understand what is wrong. Please help me out...

This is the code:

<p>/* The code was made by Tamás Imets for an Arduino UNO project
   This code controls the BB-8 Droid from the Star Wars: The Force Awakens,
   and works with Bluetooth RC Car application, using a HC-06 serial bluetooth module
   See more details at
   Friday,  December 25, 2015
 */</p><p>#include <servo.h>
#include <softwareserial.h>
#include <afmotor.h>
int command = 0;  //incoming serial data</afmotor.h></softwareserial.h></servo.h></p><p>AF_DCMotor motor1(1, MOTOR12_64KHZ); //initialize motor1 that is connected to the M1 port, this motor moves forward and backward
AF_DCMotor motor2(2, MOTOR12_64KHZ); //motor2 is connected to M2 and this turns BB-8 left and right
AF_DCMotor motorhead(3); //this motor turns the head left or right</p><p>Servo head;
void setup() {
  Serial.begin(9600); // set up Serial library at 9600 bps - this is the speed the serial interface will work all
  head.attach(9); //attach servo to pin D9 or to servo2 on motor shield
  motor1.setSpeed(255); //set default speed
  motor2.setSpeed(255); //set default speed
  motorhead.setSpeed(1); //the motor should spin very slowly
  pinMode(13, OUTPUT); //connect here the blue LED
}</p><p>void loop() {
  if (Serial.available() > 0) { //if the Arduino detects incoming data
    // read the incoming byte:
    command =;
  switch (command) //set different cases of the "command" variable
    case 'S': {; // stopped; // stopped
        command = '*';
      } break;</p><p>    case 'F': { //go forward;;
      } break;</p><p>    case 'B': { //go backward;;
      } break;</p><p>    case 'R': { //spin right;;
      } break;</p><p>    case 'L': { //spin left;;
      } break;</p><p>    case 'G': { //forward left;;
      } break;</p><p>    case 'I': { //forward right;;
      } break;</p><p>    case 'H': { //backward left;;
      } break;</p><p>    case 'J': { //backward right;;
      } break;</p><p>    case 'W': {
        digitalWrite(13, HIGH); //lights on
      } break;</p><p>    case 'w': {
        digitalWrite(13, LOW); //lights off
      } break;</p><p>    case 'U': {
        motor1.setSpeed(180); //set lower speed
      } break;</p><p>    case 'u': {
        motor1.setSpeed(255); //set max speed
      } break;</p><p>    case 'V': {; //turn head left
      } break;</p><p>    case 'v': {; //stop spinning
      } break;</p><p>    case 'X': {; //turn head right
      } break;</p><p>    case 'x': {; //stop spinning
      } break;</p><p>    case '0': {
        head.write(95); //basic servo state
      } break;</p><p>    case '1': {
        head.write(50); //move servo
      } break;</p><p>    case '2': {
        head.write(60); //move servo
      } break;</p><p>    case '3': {
        head.write(70); //move servo
      } break;</p><p>    case '4': {
        head.write(80); //move servo
      } break;</p><p>    case '5': {
        head.write(90); //move servo
      } break;</p><p>    case '6': {
        head.write(95); //move servo
      } break;</p><p>    case '7': {
        head.write(110); //move servo
      } break;</p><p>    case '8': {
        head.write(120); //move servo
      } break;</p><p>    case '9': {
        head.write(130); //move servo
      } break;</p><p>    case 'q': {
        head.write(135); //move servo
      } break;
      //you can add more extra feautres by writing a case command (example: different lights, sound, etc...)

Even on attaching and detaching the Motor Shield and Bluetooth module, it fails to upload.

I guess the softwareserial.h should be SoftwareSerial.h and same for servo.h(Should be Servo.h)

Anyways, here's a link to the Instructables site of the project for more details:

On my friend's computer, an error msg shows up stating that avrdude isn't responding and is out of sync. Another msg is related to stray '#'

Hoping for a prompt reply,
Thanks in Advance
Arpit Arun Kumaar

Copy and paste the error message here instead of screenshots; your screenshot shows a "copy error messages" button, use that.

You're more than likely right about softwareserial versus SoftwareSerial and so on. Also, those


don't belong in the code (I know they came from the instructable).

Instructables are often very poor quality. Understand the code that that instructable uses and write your own one; or find another one.

When posting code, use code tags. You can edit your above post and add
** **[code]** **
before your code and
** **[/code]** **
after your code.