My team and I are working on a project that includes a temperature sensor, 9v battery, 6 LEDs, a dc motor for a fan, and a buzzer. The goal of our project is to light up the leds in accordance with the temperature and depending on the temperature the fan's speed will increase or decrease. For some reason our simulation runs fine on circuits.io but not in real life. The fan may only turn on for a few seconds at a time. We have tested both the LED part and the motor part separately and they work fine, but when they are together it stops working. We are stuck and don't know where to go from here.
If the 9v battery is a PP3, it's time to get rid of it and use a proper battery.
Your Code?
I don't see a problem with the circuit
This is a nice little H Bridge
you should be powering arduino pins 10 and 11 opposite of each other for motor direction
digitalWright(10 = HIGH);
digitalWright(11 = !digitalRead(10)); //opposite pin 10 state
Changing Pin 10 to LOW will reverse the motor
If pin 10 and 11 are same then you will coasting or breaking depending upon pin 5 state
and analog output pin 5 for pulse width modulation
analogWrite(255) // full speed
analogWrite(0) // coasting
analogWrite(175) // @ Half speed
Z