Hi,
We are using an IR sensor to control the stepper motor
See the below code.
I want to delay for 60sec after an object is detected.
I tried delay command ..but it's not working. No error also.
Someone help me out...
Code:
#include <Stepper.h>// we include the libary
#define STEPS 100
Stepper stepper(STEPS, 2, 3);// The Pin we connected to the Stepper
//int1 = D2
//int2 = D3
//int3 = D4
//int4 = D5
int ir = 5;//IR sensor Pin
void setup()
{
pinMode(ir, INPUT);
stepper.setSpeed(100);//We Set the Speed
}
void loop() {
if (digitalRead(ir) == HIGH)//If it is LOW the object is detected
{
delay(1000);
stepper.step(5);
}
}
delay(60000);
Please remember to use code tags when posting code.
Hi,
Thanks for your reply. I tried 60000 also. but not delayed.
But I use the same delay command after the line stepper.step(5).
It's working well.
Why >:(
I don't know what the words "It's working well" and "it's not working" mean to you in this context.
TheMemberFormerlyKnownAsAWOL:
I don't know what the words "It's working well" and "it's not working" mean to you in this context.
Not working
delay(60000);
stepper.step(5);
Working well.
stepper.step(5);
delay(60000); ==> Delayed after rotation
But I want delay before rotation
I hope, Now you will understand.
HI,
I want delay the stepper step by 1 minute.
Anyone help me out...
#include <Stepper.h>
#define STEPS 100
Stepper stepper(STEPS, 2, 3);
int ir = 5;//IR sensor Pin
void setup()
{
pinMode(ir, INPUT);
stepper.setSpeed(100);//We Set the Speed
}
void loop() {
if (digitalRead(ir) == HIGH)//If it is LOW the object is detected
{
stepper.step(5);
}
}
I have tried below
{
delay(60000)
stepper.step(5);
}
Not working, just jerk after 1 minute. maybe because it's inside the loob.
TheMemberFormerlyKnownAsAWOL:
"sacking"?
a quick, sharp, sudden movement.
ARDUINOAGENT003:
I want to delay for 60sec after an object is detected.
if (digitalRead(ir) == HIGH)//If it is LOW the object is detected
{
delay(60000);
stepper.step(5);
}
Your goal, your comment , and your code are not consistent.
Maybe now is a good time to post:
a) a complete working code with schematic, and a coherent description of how it behaves.
b) a complete non-working code with schematic and a coherent description of how it behaves.
In code tags, of course.