Hot answers tagged

1

The L2978D is a terrible motor driver (I really wish people wouldn't use it!). It is "bipolar" which means that both the high and low side switches of the H-bridge are Bipolar Junction Transistors. This means that you get about 1.4V voltage drop in total between the inputs and outputs. To counter that you must provide at least 1.4V more than your ...


1

The simplest option is to use delay() to implement the waits: void loop() { turn_motor_on(); delay(10000); // 10 seconds turn_motor_off(); delay(600000); // 10 minutes } Since these long numbers may be difficult to read, you can make them more readable by defining some units: const unsigned long second = 1000; const unsigned long minute = ...


1

Start with the BlinkWithoutDelay example code and make modifications to suit your needs. This is the original code. /* Blink without Delay Turns on and off a light emitting diode (LED) connected to a digital pin, without using the delay() function. This means that other code can run at the same time without being interrupted by the LED code. ...


1

Unfortunately, the L298N does not return a status, so you are going to have to add sensors to detect motor movement. Here are a few options you can try: Current sense. Add a small resistor to the output of the L298N and measure the voltage differential across that resistor. If there is current being supplied to the motor then you will have a voltage ...


1

Figuring out your current needs is simply a matter of adding everything up. If you have 5 2 amp motors, you'll need 5 x 2, or 10 amps just to drive the motors. You should probably have at least 20% extra capacity, so I'd suggest having a 12V power supply that can put out at least 12A. 15A would be better. The stiffer your power supply the less it will "...


1

#include <Arduino.h> const int pirPin = 9; const int motorPin = 2; int switchState = 0; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(motorPin, OUTPUT); pinMode(pirPin, INPUT); } void loop() { while (digitalRead(pirPin) == HIGH)//this part of the code gets executed if the ...


Only top voted, non community-wiki answers of a minimum length are eligible