Hi,
Basically, my wild thumper wheels move only when one side is connected to the controller. If i connect both the left and right parts, there is no movement even though my multimeter shows that voltage is being passed through. I am a student and use an external DC power supply for the motor (my professor said that we'll get batteries after we get it to work using the power supply). I have kind of narrowed the problem down to 3 things (which may not even be the issue):
1)I need to use the provided high current switch (which i have no clue what it does or how to use/connect it).
2)My DC power supply isn't supplying enough current at 7.2V.
3)My wild thumper is wired wrong which i highly doubt.
Please does anyone have an idea of the problem??
My controller code is here just incase: Thanks for the help.
#include <SoftwareSerial.h>
SoftwareSerial Genotronex(1,0);
#include <Servo.h>
#include "IOpins.h"
//#include "Constants.h"
//-------------------------------------------------------------- define global variables --------------------------------------------
unsigned int Volts;
unsigned int LeftAmps;
unsigned int RightAmps;
unsigned long chargeTimer=millis();
unsigned long leftoverload;
unsigned long rightoverload;
int highVolts;
int startVolts;
int Leftspeed=0;
int Rightspeed=0;
int Speed;
int Steer;
byte Charged=1; // 0=Flat battery 1=Charged battery
int Leftmode; // 0=reverse, 1=brake, 2=forward
int Rightmode; // 0=reverse, 1=brake, 2=forward
byte Leftmodechange=0; // Left input must be 1500 before brake or reverse can occur
byte Rightmodechange=0; // Right input must be 1500 before brake or reverse can occur
int LeftPWM=128; // PWM value for left motor speed / brake
int RightPWM=128; // PWM value for right motor speed / brake
int data;
int servo[7];
int move = 0;
//-------------------------------------------------------------- define servos ------------------------------------------------------
Servo Servo0; // define servos
Servo Servo1; // define servos
Servo Servo2; // define servos
Servo Servo3; // define servos
Servo Servo4; // define servos
Servo Servo5; // define servos
Servo Servo6; // define servos
void setup()
{
//------------------------------------------------------------ Initialize Servos ----------------------------------------------------
Servo0.attach(S0); // attach servo to I/O pin
Servo1.attach(S1); // attach servo to I/O pin
Servo2.attach(S2); // attach servo to I/O pin
Servo3.attach(S3); // attach servo to I/O pin
Servo4.attach(S4); // attach servo to I/O pin
Servo5.attach(S5); // attach servo to I/O pin
Servo6.attach(S6); // attach servo to I/O pin
//------------------------------------------------------------ Initialize I/O pins --------------------------------------------------
pinMode (Charger,OUTPUT); // change Charger pin to output
digitalWrite (Charger,0); // disable current regulator to charge battery
Genotronex.begin(9600);
Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");
}
void loop()
{
//------------------------------------------------------------ Check battery voltage and current draw of motors ---------------------
Volts=analogRead(Battery); // read the battery voltage
LeftAmps=analogRead(LmotorC); // read left motor current draw
RightAmps=analogRead(RmotorC); // read right motor current draw
Servo0.writeMicroseconds(data); // set servo to default position
Servo1.writeMicroseconds(data); // set servo to default position
Servo2.writeMicroseconds(data); // set servo to default position
Servo3.writeMicroseconds(data); // set servo to default position
Servo4.writeMicroseconds(data); // set servo to default position
Servo5.writeMicroseconds(data); // set servo to default position
Servo6.writeMicroseconds(data); // set servo to default position
// --------------------------------------------------------- Code to drive dual "H" bridges --------------------------------------
// Serial mode via D0(RX) and D1(TX)
if (Genotronex.available()) //check for serial
{
// read the incoming byte:
data = Genotronex.read();
// say what you got:
// Serial.print("I received: ");
Genotronex.println(data);
mode();
delay(100);// prepare for next data ...
}
}
void mode()
{
if (data == '2')
{
// left motor forward
analogWrite(LmotorA,0);
analogWrite(LmotorB,LeftPWM);
// right motor forward
analogWrite(RmotorA,0);
analogWrite(RmotorB,RightPWM);
}
if (data == '0')
{
// left motor break
analogWrite(LmotorA,LeftPWM);
analogWrite(LmotorB,LeftPWM);
// right motor break
analogWrite(RmotorA,RightPWM);
analogWrite(RmotorB,RightPWM);
}
if (data == '1')
{
// left motor reverse
analogWrite(LmotorA,LeftPWM);
analogWrite(LmotorB,0);
// right motor reverse
analogWrite(RmotorA,RightPWM);
analogWrite(RmotorB,0);
}
if (data == '4')
{
// right motor forward
analogWrite(RmotorA,0);
analogWrite(RmotorB,RightPWM);
delay(200);
// right motor reverse
analogWrite(RmotorA,RightPWM);
analogWrite(RmotorB,0);
delay(200);
}
}