Problem powering DC motors with servos

Hi, I'm having trouble making my project work
I'm using a:
1- MPU6050 Sensor
2- 2xServo motors
2- 2xDC motors
3- L298N motor drive
4- 220V -> 9V converter (300 mA)

The driver connections are as follow:

enA = 9
in1 = 8
in2 = 7
in3 = 5
in4 = 4
enB = 3

12V -> converter +ve
5V -> arduino 5V (I know this is weird and should probably ruin the pin, I tried attaching it to Vin but it just didn't work! I'd appreciate if anyone knew a reason to this)
gnd -> converter gnd, arduino gnd

The sensor and the DC motors work just fine, however, when I modify the code to add a servo (pin 6)
neither the servo nor the right motor works.

I'm assuming the converter doesn't provide enough current but it's kinda odd as I haven't even connected the servo yet it still disable a motor of the two

I've attached the diagram and my code down here, thanks in advance

Problem.ino (1.98 KB)

Sorry but I have no idea what you're talking about. Your Fritzy shows a 3.7V battery, you talk about 220V-9V convertors and then you say where 12V and 5V are connected. Where did they come from?

Your list has 2 servos, the diagram has only one and you say you haven't connected any servos? Then the code reads a buttonPin but there's nothing on the diagram connected to that pin.

Too confusing for my old brain.

Steve

Please display your image in your post so we can see it without downloading it. See this Simple Image Guide

...R

slipstick:
Sorry but I have no idea what you're talking about. Your Fritzy shows a 3.7V battery, you talk about 220V-9V convertors and then you say where 12V and 5V are connected. Where did they come from?

Your list has 2 servos, the diagram has only one and you say you haven't connected any servos? Then the code reads a buttonPin but there's nothing on the diagram connected to that pin.

Too confusing for my old brain.

Steve

I'm sorry for the confusion, I'm using a converter indeed instead of the battery
the 12V pin in the drive takes from 7 to 12 volts so I'm plugging the 9V source in there,
The 12V and 5V pins are both in the drive

I'm using 2 servos but only one is put to test and written in the code

The pin is to switch between controlling the servos or the motors, It's connected to pin 10 and is working fine

4- 220V -> 9V converter (300 mA)

This won't power even one motor or servo.

Budget 1 Ampere per servo. Post a link to the motors, or post the stall current from the data sheet. In addition to 1 A/servo, the power supply must also be able to supply the motor stall current, typically 5-10X the running current.

5V -> arduino 5V (I know this is weird and should probably ruin the pin, I tried attaching it to Vin but it just didn't work! I'd appreciate if anyone knew a reason to this)

If a motor or servo is also connected, it can ruin the Arduino, not just the pin. Don't do this; use a separate power supply for motors and the Arduino.

The Vin or RAW input voltage must be 7V or greater.

jremington:
This won't power even one motor or servo.

Budget 1 Ampere per servo. Post a link to the motors, or post the stall current from the data sheet. In addition to 1 A/servo, the power supply must also be able to supply the motor stall current, typically 5-10X the running current.

The motors are 6V 160mA each
The servo is an sg90 micro servo

If a motor or servo is also connected, it can ruin the Arduino, not just the pin. Don't do this; use a separate power supply for motors and the Arduino.

The Vin or RAW input voltage must be 7V or greater.

I'm using the connections from this tutorial, https://www.youtube.com/watch?v=dyjo_ggEtVU&t=475s
@13:28

I'm using the connections from this tutorial, https://www.youtube.com/watch?v=dyjo_ggEtVU&t=475s
@13:28

You should not believe even a small fraction of what you see on youtube, and especially, avoid Instructables.

I can't make sense of your diagram and I can't read the pin labels on the components. Please just make a simple pencil drawing with clear labelling and post a photo of the drawing.

...R