programming quantity of steps


hello,

my name stanley , have question intership project.
it ribbon cable cutting machine.
how programm quantity of steps in arduino programm?
the stepper motor must set 10 steps , motor stop.
i didn't it.
can me please?
[const int
 
  pwm_a   = 6,
  dir_a   = 2,
  pwm_b   = 9,
  dir_b   = 8,
  sns_a   = a1;
 
  int sensor_1 = 0;
  int sensor1pin = a0;
  int d = 20;                                                     
  int steplengthinmm = 1;                                             
  int neededsteps;
  int wantedlengthinmm=10;
  int sensor_2 = 3;
  int stepcount = 0;
  int wantedquantity = 0;

  const int stepsperrevolution = 200;   
 
 
  void setup()
{                                                     
  pinmode(dir_a, output);   
  pinmode(dir_b, output);
  pinmode(pwm_a, output);
  pinmode(pwm_b, output);
  pinmode(sensor1pin, input);

  neededsteps=wantedlengthinmm/steplengthinmm;                         
 
  serial.begin(9600);   
 
 
  }
 
  void loop() {
  (int = 0; <(neededsteps); a++);                             
     
  sensor_1 = analogread(sensor1pin);                   
  serial.println(sensor_1);
  if(sensor_1>200 && sensor_1<600)       
  {
  serial.println("cable detected");         
                           
  digitalwrite(dir_a, low);
  digitalwrite(pwm_a, high);
  digitalwrite(dir_b, high);
  digitalwrite(pwm_b, high);

  delay(d);

  digitalwrite(dir_a, low);
  digitalwrite(pwm_a, high);
  digitalwrite(dir_b, low);
  digitalwrite(pwm_b, high);
 
  delay(d);

  digitalwrite(dir_a, high);
  digitalwrite(pwm_a, high);
  digitalwrite(dir_b, low);
  digitalwrite(pwm_b, high);

  delay(d);
 
  digitalwrite(dir_a, high); 
  digitalwrite(pwm_a, high);   
  digitalwrite(dir_b, high);
  digitalwrite(pwm_b, high);

  delay(d);
 
 
 
 
  }
  else
  {digitalwrite(dir_a, low);
  digitalwrite(pwm_a, low);
  digitalwrite(dir_b, low);
  digitalwrite(pwm_b, low);

  serial.println("no cable");                                       
   delay(100);
  }
 
                                                             
 
}]

stanley

quote
how programm quantity of steps in arduino programm?
code: [select]
int numsteps = 10; // or, whatever value want.

quote
i didn't it.
obviously. there stickies @ top of forum, supposed read before blundered in here. don't it. apply you.

the code something. don't it. need tell does.

you expect something. don't it. need tell expect do.

code: [select]
  (int = 0; <(neededsteps); a++);                           
have seen example, anywhere, of statement ended in ;?

what think happen when correct this, , give statement body? happen when loop() ends?


Arduino Forum > Using Arduino > Programming Questions > programming quantity of steps


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts