I have the dagu rover 5 chassis with 2 encoders and the dagu 4 channel motor controller and the redback spider atmega 1280. I purchased the rocketbot app for android to control my robot. I was able to hit the forward button and make my bot move forward but that is it it wont stop it wont move left or right or even please help asap I have a week and 2 days before my capstone for ITT Tech here is what i have so far for the code. I really just need it to be real basic.
// Included for serial communication
#include <SoftwareSerial.h>
#define motorA 9 //Direction Pin for Left Motor
#define motorSpeedA 10 //Speed Pin for Left Motor
#define motorB 12 //Direction Pin for Right Motor
#define motorSpeedB 11 //Speed Pin for Right Motor
// Define pins you're using for serial communication
// for the BlueSMiRF connection
#define TXPIN 1
#define RXPIN 0
// Create an instance of the software serial object
SoftwareSerial BlueSerial(RXPIN, TXPIN);
// Main application entry point
void setup()
{
pinMode(motorA, OUTPUT);
pinMode(motorB, OUTPUT);
pinMode(motorSpeedA, OUTPUT);
pinMode(motorSpeedB, OUTPUT);
// Define the appropriate input/output pins
pinMode(RXPIN, INPUT);
pinMode(TXPIN, OUTPUT);
// Begin communicating with the bluetooth interface
Serial.begin(9600);
BlueSerial.begin(9600);
// Say we are starting the serial com
Serial.println("Serial start!");
BlueSerial.println("Serial start!");
}
// Main application loop
void loop()
{
// Wait for command-line input
if(Serial.available() > 0)
{
// Read off all bytes
BlueSerial.print( Serial.read(), BYTE );
analogWrite(motorSpeedA,255);
analogWrite(motorSpeedB,255);
forward();
backward();
leftSpin();
rightSpin();
}
}
void forward()
{
//forward
digitalWrite(motorA,HIGH);
digitalWrite(motorB,HIGH);
}
void backward()
{
digitalWrite(motorA,LOW);
digitalWrite(motorB,LOW);
}
void leftSpin()
{
digitalWrite(motorA,LOW);
digitalWrite(motorB,HIGH);
}
void rightSpin()
{
digitalWrite(motorA,HIGH);
digitalWrite(motorB,LOW);
}
void allStop()
{
digitalWrite(motorA,LOW);
digitalWrite(motorB,LOW);