Hi, Im making a RC boat controlled through an android phone. Im using the Arduino Uno board, a hc-05 bluetooth module, a micro servo and a motor driver. Im having trouble compiling the code, it continues to say; avrdude: stk500_recv(): programmer is not responding
My code is shown below, can someone please help as I have to meet a deadline.
#include <SoftwareSerial.h>
#include <Servo.h>
int bluetoothTX = 2;
int bluetoothRX = 3;
SoftwareSerial bluetooth(bluetoothTX, bluetoothRX) ;
// Motor 1 - controlled forward and back
int Motor1A = 5;
int Motor1B = 6;
// Motor 2 - controlled left and right
int Motor2A = 9;
int Motor2B = 10;
Servo myservo;
int ServoPort = 4;
int ValueLeft = 60;
int ValueMid = 30;
int ValueRight = 0;
void setup ()
{
//Setup Bluetooth serial connection to IOS
bluetooth.begin(115200);
bluetooth.print("444");
delay(100);
bluetooth.println("U,9600,N");
bluetooth.begin(9600);
pinMode( Motor1A, OUTPUT );
pinMode( Motor1B, OUTPUT );
digitalWrite( Motor1A, LOW );
digitalWrite( Motor1B, LOW );
pinMode( Motor2A, OUTPUT );
pinMode( Motor2B, OUTPUT );
digitalWrite( Motor2A, LOW );
digitalWrite( Motor2B, LOW );
myservo.attach(ServoPort);
myservo.write(ValueMid);
}
int flag1 = -1;
int flag2 = -1;
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available())
{
char toSend = (char)bluetooth .read();
bluetooth.write(toSend);
if(toSend == '5')
{
flag1 = 0;
flag2 = 0;
digitalWrite( Motor1A, LOW );
analogWrite( Motor1B, LOW );
digitalWrite( Motor2A, LOW );
analogWrite( Motor2B, LOW );
}
if ((toSend == 'F') || (toSend == 'G') || (toSend == 'I'))
{
if(flag1 != 1)
{
flag1 = 1;
digitalWrite( Motor1A, HIGH );
analogWrite( Motor1B, 50 );
}
}
if(toSend == 'B' || toSend == 'N' || toSend == 'J')
{
if(flag1 != 2)
{
flag1 = 2;
digitalWrite( Motor1B, HIGH );
analogWrite( Motor1A, 50 );
}
}
if(toSend == 'L' || toSend == 'G' || toSend == 'H')
{
if(flag2 != 1)
{
flag2 = 1;
digitalWrite( Motor2B, HIGH );
analogWrite( Motor2A, 50 );
myservo.write(ValueLeft);
}
}
else
if(toSend == 'R' || toSend == 'I' || toSend == 'J')
{
if(flag2 != 2)
{
flag2 = 2;
digitalWrite( Motor2A, HIGH );
analogWrite( Motor2B, 50 );
myservo.write(ValueRight);
}
}
else
{
if(flag2 != 3)
{
flag2 = 3;
digitalWrite( Motor2A, LOW);
analogWrite( Motor2B, LOW);
myservo.write(ValueMid);
}
}
}
}