GOOD DAY. I HOPE SOMEONE CAN HELP ME WITH THIS PROBLEM. I WONT TO CONNECT 2 MOTORS ON M3 AND M4 AND FOR SOME REASONS I CAN'T FIND THE PROBLEM WITH THE CODE . EVERYTHING IS WORKING 80% BUT I CANT SEEM TO FIGURE IT OUT. IM VERY NEW TO THIS AND I HOPE A FRESH PEAR OF EYES CAN HELP.
In the Arduino IDE, use CtrlT or CMDT to format your code then copy the complete sketch. Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.
Well if i try in included in the code af_dcmotor(1); then only one motor is working as it must going forward and backwards when pushing the bottons . but if i at a nother motor like #include <AFMotor.h>
AF_DCMotor motor(1,2);
then still only one motor is working . its not working on m2 . only on m1 point .
Im still new at getting it right to a pount but i have hit a brick wall here .
the i.d is the there's two motors on both sides of the platform and when the forward button is pushed the the hole draw opens up and when you press the close boton then the draw closes . the stop button is as an emergency stop as if i can say it like that.
I don't know about others, but I still don't know exactly what is wrong. Maybe try a truth table or some simple way of telling us what works, and what does not work.
Another thing to try is to use the sample code to do the movements and make some modifications for the other stuff. Also using a button library gets rid of half your code.
You are creating a motor object on channel 3.
Hence you can then refer to motor in your sketch as you did.
AF_DCMotor motorOne(1);
AF_DCMotor motorTwo(2);
Above we are creating 2 objects, motorOne on channel 1 and motorTwo
on channel 2
We can then refer to motorOne and motorTwo in the sketch to control the motors.
You do know that the object names need to be adjusted throughout to rest of the sketch ?
As examples:
motorOne.setSpeed(255)
motorOne.run(FORWARD) OR
motorTwo.setSpeed(127);
motorTwo.run(FORWARD)
I moved your topic to an appropriate forum category @Davidcencon.
In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.