A stepper library error?


i have problem in uploading below sketch.the arduino ide give error'cnc_controller.ino: in function 'void setup()':
ucnc_controller:94: error: 'initmotors' not declared in scope
ucnc_controller.ino: in function 'void loop()':
ucnc_controller:123: error: 'process_command' not declared in scope
ucnc_controller:130: error: 'powerdown' not declared in scope"

i have been told replace stepper library newer one.i have tried several versions of arduno.ranging old ide release ones.the error same.and found stepper library built-in of each arduino ide.i can't find advanced stepper library.now guess problem coding.maybe contains bugs.but not sure.so post here hoping guide me walk on it.

code: [select]
#include <servo.h>
#include <stepper.h>

/* version of progam */
float ucnc_version = 1.0;

/* development functions - broken code*/
//#define builtin 1
//#define broken 1

/* conversion factor of steps per millimeter */
float stepspermillimeter_x = 200 / 17.1;
float stepspermillimeter_y = -200 / 17.1;
float stepspermillimeter_z = 200 / 17.1;

/* unit conversion factor */
float conversionfactor = 1;  // 1 mm 25.4 inches

/* stepper library initialization */
const int stepsperrevolution = 200;  // change fit number of steps per revolution
stepper mystepper1(stepsperrevolution, 8,9,10,11);
stepper mystepper2(stepsperrevolution, 4,5,6,7);           
stepper mystepper3(stepsperrevolution, 17,16,19,18);

/* servo functions , limits */
servo myservo;

int servoposmax=83;
int servoposmin=70;
int servotoolinc=10;
float servoposzfactor=1.0;

/* mode selector motors (see documentation) */
int   motormode = 0;

/* x,y,z in absolute steps position */
int x = 0;
int y = 0;
int z = 0;

/* x,y,z in measurement value*/
float posx = 0.0;
float posy = 0.0;
float posz = 0.0;

/* tools , feeds , coolants */
int tool     = 0;
int spindle  = 0;
int coolant1 = 0;
int coolant2 = 0;

/* spindle speed (m3 parameter)*/
int spindlespeed = 0;

int led = 13;

#define command_size 128
uint8_t command_line[command_size];
uint8_t sin_count=0;
uint16_t no_data = 0;
uint8_t asleep = 0;


void setup() {
  serial.begin(9600);
 
  // led (laser output)
  pinmode(led, output);
  // general pupose (coolant 1) output
  pinmode(2, output);
  // general pupose (coolant 2) output
  pinmode(3, output);
 
  /* init steppers , servo */
  initmotors();
}

void clear_command_string() {
  (int i=0; i<command_size; i++)
    command_line[i] = 0;
  sin_count = 0;
}

void loop() {
  uint8_t c;
 
  serial.println("ready");

  while (true) {
    //read in characters if got them.
    if (serial.available() > 0)   {
      c = (uint8_t)serial.read();
      no_data = 0;
      asleep = 0;
      command_line[sin_count++] = c;
    }
    else {
      no_data++;
      delaymicroseconds(150);
    }
 
    if (sin_count && (c == '\n' || no_data > 100)) {
      command_line[sin_count] = 0;
      process_command(command_line);
      //sin_count=0;
      clear_command_string();
    }
 
    if (no_data == 60000)  {
      if (!asleep) {
        powerdown();
        asleep=1;
      }
    }
  }
}

quote
ucnc_controller:94: error: 'initmotors' not declared in scope

code: [select]
  initmotors();
so, have defined function? not part of stepper class. if was, you'd need call instance of stepper class.

code: [select]
  while (true) {
no! there no excuse putting infinite loop in infinite loop().

quote
ucnc_controller:123: error: 'process_command' not declared in scope

code: [select]
      process_command(command_line);
so, have defined function? not part of stepper class. if was, you'd need call instance of stepper class.


Arduino Forum > Using Arduino > Programming Questions > A stepper library error?


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support