Stepper motor controlled by temperature sensor
hello all,
i have been tinkering around small stepper motor. have arduino running temperature sensor, lcd, , hbridge bipolar (4 pin) stepper motor. code have runs temperature sensor value every 2 seconds , has if statement run stepper motor @ 78 rpm fixed amount of steps. problem doing of in void loop, run command have motor run, if temp remains in correct range run loop on again.
[
if(temperaturef >= tempfstart)
{
mystepper.setspeed(0);
mystepper.step(0);
}
else
{
mystepper.setspeed(78); //motor travels @ 0.5 inches/4 seconds
mystepper.step(375); //motor turns 375 steps = 1.5 inches traveled
}
]
my question how make program run through , activate motor when reaches degree range , stop?
my other question how can make motor stay until temperature sensor value goes within range? can make motor return 0 position?
again, segment of code provided within void loop.
any or tips appreciated
i have been tinkering around small stepper motor. have arduino running temperature sensor, lcd, , hbridge bipolar (4 pin) stepper motor. code have runs temperature sensor value every 2 seconds , has if statement run stepper motor @ 78 rpm fixed amount of steps. problem doing of in void loop, run command have motor run, if temp remains in correct range run loop on again.
[
if(temperaturef >= tempfstart)
{
mystepper.setspeed(0);
mystepper.step(0);
}
else
{
mystepper.setspeed(78); //motor travels @ 0.5 inches/4 seconds
mystepper.step(375); //motor turns 375 steps = 1.5 inches traveled
}
]
my question how make program run through , activate motor when reaches degree range , stop?
my other question how can make motor stay until temperature sensor value goes within range? can make motor return 0 position?
again, segment of code provided within void loop.
any or tips appreciated
you need "flag" test each time @ temperature.
flag = false
if temp above trigger point , flag false
run motor
set flag true
else if temp below trigger point
set flag false
this run motor fixed number of steps state in first paragraph.
however later want run until temperature goes range. can't have both @ same time.
weedpharma
flag = false
if temp above trigger point , flag false
run motor
set flag true
else if temp below trigger point
set flag false
this run motor fixed number of steps state in first paragraph.
however later want run until temperature goes range. can't have both @ same time.
weedpharma
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Stepper motor controlled by temperature sensor
arduino
Comments
Post a Comment