Setting rpm of stepper motor per minute


hi,
i started programming arduino , hardly know it, hope can me. try make stepper motor change it's rpm every minute value described in array. somehow delay use seems stop stepper motor completely. use customstepper library. can me i'm doing wrong?
thanks lot!


code: [select]
//copyright 2012 igor campos
//
//this file part of customstepper.
//
//customstepper free software: can redistribute and/or modify
//it under terms of gnu general public license published by
//the free software foundation, either version 3 of license, or
//(at option) later version.
//
//customstepper distributed in hope useful,
//but without warranty; without implied warranty of
//merchantability or fitness particular purpose.  see the
//gnu general public license more details.
//
//you should have received copy of gnu general public license
//along customstepper.  if not, see <http://www.gnu.org/licenses/>.

#include <customstepper.h>

//lcdschermpje
#include <liquidcrystal.h>
 //rs op pin 12
 //rw op pin 11
 //d4,d5,d6,d7 op pin 6,7,8,9
 liquidcrystal lcd(12,11,6,7,8,9);

//full constructor, first 4 parameters necessary, pins connected motor,
//the others optional, , default following below
//the 5th paramater steps sequence, 1st element of array number of steps
//it can have maximum of 8 steps
//the 6th parameter spr (steps per rotation)
//the 7th parameter rpm
//the 8th parameter rotation orientation
customstepper stepper(2, 3, 4, 5, (byte[]){8, b1000, b1100, b0100, b0110, b0010, b0011, b0001, b1001}, 4075.7728395, 12, cw);
//boolean rotate1 = false;
//boolean rotatedeg = false;
//boolean crotate = true;

float lut[] = {10,5,1,.5,1,2};
int i=0;

void setup()
{
 //sets rpm
 stepper.setrpm(15);
 //sets steps per rotation, in case 64 * 283712/4455 annoying gear ratio
 //for motor (it works float able deal these non-integer gear ratios)
 stepper.setspr(4075.7728395);
 lcd.begin(16, 2);

 // print message lcd.
 lcd.setcursor(0, 0); // first row.
 lcd.print("volg de sterren!!!!");
 lcd.setcursor(0, 1); // first row.
 lcd.print("***************************");
 lcd.display();
}

void loop()
{
   float value = lut[i%6];
   stepper.setrpm(value);

   
//when command finished isdone return true, important notice that
 //you can't give 1 command after since don't block execution,
 //which allows program control multiple motors
 if (stepper.isdone()

 )
 {
   //this method sets direction of rotation, has 3 allowed values (cw, ccw, , stop)
   //clockwise , counterclockwise first 2
   stepper.setdirection(ccw);
   //this method sets motor rotate given number of times, if don't specify it,
   //the motor rotate untilyou send command or set direction stop
   stepper.rotate(1);


 }

 stepper.run();
   lcd.setcursor(0,0);
 lcd.print(value);
 lcd.display();
delay(60000);
 i++;
}

code: [select]
#include <customstepper.h>
that not core library. need provide link.

code: [select]
  if (stepper.isdone()

  )

the close paren belongs on same line if statement goes with.

quote
however somehow delay use seems stop stepper motor completely.
]
well, of course does. why surprise?


Arduino Forum > Using Arduino > Programming Questions > Setting rpm of stepper motor per minute


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support