hi. i am doing a project "fire extinguisher robot". for obstacle avoidance, i use ultrasonic sensor. got the code for it. planned to connect motors like,, motors in one side will be a connection( +ve and -ve) , motors on other side will be another connection. this will help in getting anti-clockwise and clockwise direction (left,right) i thought. but now, i coded for motors to run front, back and all. but its not working. here is the code.
int a=13, b=12, c=10, d=9;
void setup()
{
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
}
void loop()
{
front();
}
void front()
{
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
}
void back()
{
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
}
void left()
{
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
}
void right()
{
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
}
is there anything wrong?? please do tel me as i am a noob..now only learning..can i use h-bridge? i have a h-bridge motor drive 1.1 (l298n). if so, can u please provide the coding.?? thanks