Elegoo robot car kit: left side drive not working when I connect a servo

Thread Starter

Hosie2018

Joined Sep 14, 2018
2
Hi AAC community,
there are 4 motors driven through the l298n driver board which work fine (about 6V) until i add the servo.
When i connect the servo and upload the code the servo and right hand drive work but left hand drive stops working all together (0V).

Can anyone help?

Kind regards
Mike
 

Thread Starter

Hosie2018

Joined Sep 14, 2018
2
I've tried:
  • changing boards
  • swapping the servo to all free digital pins
  • disconnecting and reconnecting terminations
  • deleting lines of code for the servo
When i attach the servo to any pin with myservo.attach(n); the left hand drive stops working but only for forward and back commands.
All 4 motors engage fine to turn left or right...weird.
There seems to be some kind of clash with the servo library

#include<Servo.h>
Servo myservo
void setup(void){
myservo.attach(n);
//when this line is added _mForward and _mBackward functions stop working correctly
}

_mForward and back works when i swap out the code above for this:

int myservo = n;

void setup(void){
pinMode(myservo, OUTPUT);
}
 
Top