Go Down

Topic: Facing errors in Motor related code! Please help (Read 382 times) previous topic - next topic

Shaurya302000

I have Arduino 1.6.5 . I ran an example program 'Motor test' within 'Robot Control' . using arduino UNO board with a L293D motor shield. Somehow when I verify the program, it gives a lot of errors. What can be the solution for this? If possible can anyone please give me the verified one?

MarkT

You selected 'Arduino Robot Control' as the board type now didn't you?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Robin2

If you want help you need to post your code and post the errors you are getting.

And please use the code button </>
Code: [Select]
so your code looks like this and is easy to copy to a text editor

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Shaurya302000

Code: [Select]
  #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);
}     



So which board should I select? Because I am operating using Arduino UNO

MarkT

That code works only with the Arduino Robot Control board, as far as I can see.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Shaurya302000

When I selected Robot Control Motor, it got verified and then when I was uploading it to my UNO on which the motor shield is connected, it was not getting uploaded. Any idea how to fix that?

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

MarkT

Its example code for the Arduino Robot board only, that's why its in the Robot Control section of examples.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

3dprinter

it was not getting uploaded.
Presumably, although you do not say what went wrong at the upload, it said avrdude: Yikes!  Invalid device signature or something to that effect. You have to select the actual board you are using, not the one you would like it to be.
Any idea how to fix that?
The library you specify (that is the 1st line in your example) has to match the addon board you are using. If you are not using the Arduino robot stuff, then use the right motorshield library.

Go Up