Help ME !!! I want Help !!

``#include <AFMotor.h> //import your motor shield library
#define trigPin 12 // define the pins of your sensor
#define echoPin 13
AF_DCMotor motor1(1,MOTOR12_64KHZ); // set up motors.
AF_DCMotor motor2(2, MOTOR12_8KHZ);

void setup() {
Serial.begin(9600); // begin serial communitication
Serial.println("Motor test!");
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
motor1.setSpeed(105); //set the speed of the motors, between 0-255
motor2.setSpeed (105);

void loop() {

long duration, distance; // start the scan
digitalWrite(trigPin, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trigPin, HIGH);

delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;// convert the distance to centimeters.
if (distance < 25)/*if there's an obstacle 25 centimers, ahead, do the following: */ {
Serial.println ("Close Obstacle detected!" );
Serial.println ("Obstacle Details:");
Serial.print ("Distance From Robot is " );
Serial.print ( distance);
Serial.print ( " CM!");// print out the distance in centimeters.

Serial.println (" The obstacle is declared a threat due to close distance. ");
Serial.println (" Turning !");; // stop !! (RELEASE);

else {
Serial.println ("No obstacle detected. going forward");
delay (15);; //if there's no obstacle ahead, Go Forward!;


i WANT to proVidE proper power supply. i was using 9v batery but it was not enough So, please tell me a proper power supply

You failed at using code tags. Please try again. I asked you to Auto Format your code in your other post but you still didn't do it.

The title of your post is completely unhelpful. Don't you think everyone posting on this forum wants help? You would be much more likely to get help if you provide an appropriate title and act respectfully.

The title of this Thread brings to mind a two-year-old child throwing a tantrum "ICE CREAM" "I WANT ICE CREAM"

In any case, if you are trying a PP3 style of 9v battery then change to a pack of 6xAA cells. The PP3 batteries cannot provide enough current.


read #6 and #7
come back, edit your first post (bottom right end of your post, use modify)

post information about your motors.
most motors need a LOT of power and batteries cannot deliver enough power.

I have a suggestion: if you are trying to do something with an Arduino and motors, perhaps you should find out what an ampere is, then what an ampere hour is, how to use an ammeter, and then determine for yourself how much battery you need. There is no point wading into electronics without even a smattering of fundamental knowledge.


SibasisMalla......Ok...I'll bash u a bit too......Read The "etiquette of posting.....your topic is the "WORST CASE SCENARIO"

BUT on another note...............

Not knowing all you didn't elaborate on ....cause I/we don't know your project...

It sounds like your not separating your control functions (Arduino) which run on low voltage low current....from your device which apparently uses more than the circuitry can handle...

You need another controller that you can talk to...

Or add a "shield" that is designed for that purpose

can you say do-over ?

good subect line :

Having problems with steppers

body of post :
I have a [ provide link ] stepper driver / shield.

here is my code so far, but it is not working :

[ insert code in code tags ]

end with : since I am new, let me know if you need any other information and I will post as best I can.

just abandon this thread as it is useless.
start a new thread and we will all be happy, you, us, everyone.

it's not useless... it's a textbook example of how not to post, and how not to elicit help from willing 'experts'

LOVe the cartoon in Reply #6 - LOL