97Views4Replies
How to make a motor related arduino code?
I need a proper program in which I have 2 motors in which I need to make turns by reducing the speed of one motor and then come back to normal. Please I need help!
I need a proper program in which I have 2 motors in which I need to make turns by reducing the speed of one motor and then come back to normal. Please I need help!
Comments
5 years ago
Help is a function of what you can understand.
What is your coding skill ?
And your electronic know how ?
What are your answers to maewert ?
Answer 5 years ago
to add to maewert's answers, I am using a Arduino UNO board. The motor shield has been fixed on it
5 years ago
How are you controlling the motors? Are you using a motor shield? Are they stepper motors or plain DC motors? Are you using Pulse Width Modulation to change the motor speed?
Answer 5 years ago
I am using a L293D motor shield, I have been working on a code. check it out
#include <ArduinoRobot.h>
#include <Wire.h>
#include <SPI.h>
void setup() {
// initialize the robot
Robot.begin();
}
void loop() {
Robot.motorsWrite(255, 255); // move forward
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
Robot.motorsWrite(-255, -255); // backward
delay(1000);
Robot.motorsWrite(0, 0); // slow stop
delay(1000);
Robot.motorsWrite(-255, 255); // turn left
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
Robot.motorsWrite(255, -255); // turn right
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
}
its not compiling and giving an error. Any mistakes?