Lesson 55: Controlling DC Motors with 2 push buttons with L298N | Arduino Step By Step Course

  Рет қаралды 11,508

Robojax

Robojax

Күн бұрын

Пікірлер: 12
@الخطاطالعراقي-د5و
@الخطاطالعراقي-د5و 3 жыл бұрын
awesome.... good work
@Drxxx
@Drxxx 3 жыл бұрын
Great project, super channel
@electronic7979
@electronic7979 3 жыл бұрын
Faydalı bir video. Beğenerek izledim.
@elowpiku2642
@elowpiku2642 11 ай бұрын
I have a doubt inorder to power a 6v DC motor do i need to provide power >6v or 6v along can power up the motor, is there any voltage drop in this driver ?
@robojax
@robojax 11 ай бұрын
Yes there is voltage drpop of about 0.7V. This is not introduction video. I have explained it in the introduction to L298N.
@louisdecarufel2327
@louisdecarufel2327 Жыл бұрын
Hi, I'm very new in arduino uno coding. I was looking for your lesson 55 code that control motor with l298n. The code is very nice but it's a little bit to much for what i'm looking for. I Just need to control the motor cw start by 1 switch and stop with another switch and than, after stop, turn a LED on with a digital IO. Can you help me? I can read and understand some easy codes but my knoledge is too Light to write the code myself. Thanks
@robojax
@robojax Жыл бұрын
Hi, I got your email and responded.
@samuelfernandez8639
@samuelfernandez8639 Жыл бұрын
Thanks, awesome video! Please, do you have some video or coding to apply these steps for ESP 32? Thanks again @Robojax
@robojax
@robojax Жыл бұрын
There is esp8266 video you can learn from
@samuelfernandez8639
@samuelfernandez8639 Жыл бұрын
@@robojax 🙏🤙
@jadalkhabbaz7516
@jadalkhabbaz7516 9 ай бұрын
motor one is working but the second motor is not, knowing that i changed the code and declared all the pins: #include // motor 1 settings #define IN1 2 #define IN2 4 #define ENA 3 // ~this pin must be PWM enabled pin // motor 2 settings #define IN3 7 #define IN4 6 #define ENB 5 // ~this pin must be PWM enabled pin const int CCW = 2; // do not change const int CW = 1; // do not change #define motor1 1 // do not change #define motor2 2 // do not change const int pushButtonDelayTime =200; //*** Push buttons for motor 1 started int motor1Speed =60;// speed of motor 1 in % (60 means 60%) const int motor1PushButtonDirection = 8;// push button for direcion change const int motor1PushButtonStop = 9;// push button for START/STOP const int motor1Minimum =15;//30% is minimum for motor 1 // do not change below this line int motor1Direction =CCW;// int motor1StopState=HIGH;//Stope state of motor 1 //*** Push buttons for motor 1 started ended //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //*** Push buttons for motor 2 started int motor1Speed =60;// speed of motor 1 in % (60 means 60%) const int motor2PushButtonDirection = 10;// push button for direcion change const int motor2PushButtonStop = 11;// push button for START/STOP const int motor2Minimum =15;//30% is minimum for motor 1 // do not change below this line int motor2Direction =CCW;// int motor2StopState=HIGH;//Stope state of motor 1 //*** Push buttons for motor 2 started ended //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // use the line below for single motor //Robojax_L298N_DC_motor motor(IN1, IN2, ENA, true); // use the line below for two motors Robojax_L298N_DC_motor motor(IN1, IN2, ENA, IN3, IN4, ENB, true); void setup() { Serial.begin(115200); motor.begin(); //L298N DC Motor by Robojax.com pinMode(motor1PushButtonDirection, INPUT_PULLUP); pinMode(motor1PushButtonStop, INPUT_PULLUP); //L298N DC Motor by Robojax.com pinMode(motor2PushButtonDirection, INPUT_PULLUP); pinMode(motor2PushButtonStop, INPUT_PULLUP); } void loop() { updateState1();//read all push 1 buttons if(motor1StopState ==HIGH) { motor.brake(motor1); }else{ motor.rotate(motor1, motor1Speed, motor1Direction); } //motor.demo(1); //motor.rotate(motor1, motor1Speed, CW);//run motor1 at 60% speed in CW direction delay(pushButtonDelayTime); updateState2();//read all push 1 buttons if(motor2StopState ==HIGH) { motor.brake(motor2); }else{ motor.rotate(motor2, motor2Speed, motor2Direction); } //motor.demo(1); //motor.rotate(motor1, motor1Speed, CW);//run motor1 at 60% speed in CW direction delay(pushButtonDelayTime); }// /* * * updateState1() * @brief reads push buttons and updates values * @param none * @return no return * Written by Ahmad Shamshiri for robojax.com * on Oct 13, 2019 in Ajax, Ontario, Canada */ void updateState1() { if(digitalRead(motor1PushButtonDirection) ==LOW){ if(motor1Direction ==CW) { motor1Direction =CCW;// Serial.println("*****Now CCW"); }else{ motor1Direction =CW;// Serial.println("*****Now CC"); } } if(digitalRead(motor1PushButtonStop) ==LOW) { motor1StopState =1-motor1StopState;// toggle Star/stop } }//updateState end void updateState2() { if(digitalRead(motor2PushButtonDirection) ==LOW){ if(motor2Direction ==CW) { motor2Direction =CCW;// Serial.println("*****Now CCW"); }else{ motor2Direction =CW;// Serial.println("*****Now CC"); } } if(digitalRead(motor2PushButtonStop) ==LOW) { motor2StopState =1-motor2StopState;// toggle Star/stop } }//updateState end
@robojax
@robojax 9 ай бұрын
why you posted the whole code. the code is part of the library and we all know how it looks like. your comment was treated by KZbin as spam and thanksfully I just checked today. Usually I check it every 2 or 3 weeks. Please use the provided code without any modification. if you do and it does not work, then the wriing is incorrect. firx the woring.
Lesson 56 : What is an Arduino function and how to use them?
25:30
Driving DC Motors with Microcontrollers
1:04:32
DroneBot Workshop
Рет қаралды 735 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
How Motors Work For Beginners (Episode 1): The DC Motor: 032
13:45
Jeremy Fielding
Рет қаралды 2,5 МЛН
Beginner's Guide to Controlling Stepper Motors with Arduino
9:59
Rachel De Barros
Рет қаралды 47 М.
Arduino Tutorial 37: Understanding How to Control DC Motors in Projects
31:25
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН