• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Newbie – Have put together a 4 wheeled robot car – With utltrasonic ping sensor – Using the Adafruit V2 motor shield

Q&A Forum › Category: Arduino › Newbie – Have put together a 4 wheeled robot car – With utltrasonic ping sensor – Using the Adafruit V2 motor shield
0 Vote Up Vote Down
Kumar Krishnamurthi asked 9 years ago

The robot car moves forwards and backwards perfectly and the sensor and servo which pans it also seems to work fine but as it comes closer to obstructions it does not seem to process the actions programmed to reverse or avoid collision.  I am more of a script kiddie, Cut and pasted codes from various sources on the web.  None which was using the combination I have used so had to figure it out on my own and now stuck….F1 F1 F1 anyone

4 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 9 years ago

Hi Kumar, Thanks for joining the Lab! Can you share your code? Please post your code on http://pastebin.com/.Then copy and past the link that generates. So it’s easier to help 

0 Vote Up Vote Down
Kumar Krishnamurthi answered 9 years ago

Hi Rui, I have pasted the code i have used. The previous code where the rover servo was panning, has stopped for some reason. rechecking the code, still i am stuck on this. Now it seems to keep moving forwards and backwards only. I should have saved the previous code which i had it working, I kept modifying the same and lost the original one which atleast was moving forwards and the servo pans and can see the distance measurements on the serial monitor. Alas foolish of me to have modified the same code without doing a save as before modifying it. Please tell me where i need to correct the code. I would like to this time understand where i am wrong. Thanks in Advance. regards Kumar http://pastebin.com/4yJENnhM

0 Vote Up Vote Down
Rui Santos Staff answered 9 years ago

You need to be careful with the motor connections . When you can any of the motor funtctions where direction can be BACKWARD, FORWARD or RELEASE. The Arduino doesn’t actually know if the motor is BACKWARD orFORWARD , so if it’s rotating in the wrong direction, simply swap the two wires from the motor to the shield and it should work.

0 Vote Up Vote Down
Rui Santos Staff answered 9 years ago

I don’t have the shield, so I can’t personally test the project. But before you add the ultrasonic sensor functionality make sure you can control the motors in the right direction. You should start with a more basic example https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/overview and make the backward and forward movements

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.