Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To our project we use this code in arduino shown below, Its to move the stepper motor for a desired steps(pulses) The problem of this

To our project we use this code in arduino shown below,
Its to move the stepper motor for a desired steps(pulses)
The problem of this code is that it move right after we turn on the power source that connecting to the arduino, and we need to modify it to make it move after we give a command in command window to start the movement. Please help if you know how to modify it to our purpose( maybe with sirial monitor?) or give as any suggestions how to modify it ( to make the code start when only we command the code to start)
the code:

const int stepPin = 5;

const int dirPin = 2;

const int enPin = 8;

void setup() {

pinMode(stepPin,OUTPUT);

pinMode(dirPin,OUTPUT);

pinMode(enPin,OUTPUT);

digitalWrite(enPin,LOW);

}

void loop() {

digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction

for(int x = 0; x

digitalWrite(stepPin,HIGH);

delayMicroseconds(500);

digitalWrite(stepPin,LOW);

delayMicroseconds(500);

}

delay(1000); // One second delay

digitalWrite(dirPin,LOW); //Changes the direction of rotation

for(int x = 0; x

digitalWrite(stepPin,HIGH);

delayMicroseconds(500);

digitalWrite(stepPin,LOW);

delayMicroseconds(500);

}

delay(1000);

}

image text in transcribed
sketch_dec19a 1 rold logp(b t digitaiwrite (dirpin, HIOH); // Enables the motor to move 1n a particular direction for (1ntx=0;x

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions