4-axis Arduino based CNC hot wire foam cutter

Home Forum Everything Else 4-axis Arduino based CNC hot wire foam cutter

Viewing 25 posts - 1 through 25 (of 27 total)
  • Author
    Posts
  • #6109
    AvatarAnonymous
    Inactive

    I load the file in your GcodeSender – but with all the periods removed. And it goes to the end of the file and all four steppers moves perfectly. It looks like this.

    https://youtu.be/UsOdinHTPPk

    G21
    G17
    G90
    M3
    G0 X00000 Y00000 Z00000 E00000
    G1 X00000 Y250000 Z00000 E250000
    G0 X00000 Y300000 Z00000 E300000
    G0 X1466223 Y00000 Z1255086 E00000
    G0 X00000 Y-100000 Z00000 E-100000
    G1 X00000 Y-102681 Z00000 E-118601
    G1 X01445 Y-00050 Z00592 E-00458
    G1 X01441 Y-00116 Z00579 E-00474
    ….. more 990 lines or so

    I need to calibrate your code so the gcode command e.g.

    G0 X0.0000 Y30.0000 Z0.0000 E30.0000

    makes the stepper turn an equivalent to what is 1mm exactly. This is what I need, for this generated gcode to do what it is supposed to do. I think it is close to one whole turn or something like that.

    I have been searching inside your code, but I was unable to allocate where you have set this option. I think it might be the step rate?
    What is wrong? Hopefully something simple…

    Regards Søren

    #7050
    AvatarAnonymous
    Inactive

    The x and y value are already # of steps. You’ll need to add something at the start of line() and converts xyze to steps on each motor. Look at ik() in makelangelo firmware_rumba to see how it’s done.

    #7051
    AvatarAnonymous
    Inactive

    Hi Dan,

    So now I have found a solution. Well it seems so.

    I have modified the file a little. Took away what I did not need, and added a few things.

    Added STEPS_PER_MM as a constant

    and put it here in your code:

    void line(float newx,float newy,float newz,float newe) {
    a[0].delta = (newx-px)*STEPS_PER_MM;
    a[1].delta = (newy-py)*STEPS_PER_MM;
    a[2].delta = (newz-pz)*STEPS_PER_MM;
    a[3].delta = (newe-pe)*STEPS_PER_MM;

    And this very simple solution makes my steppers turn exactly the way I want.

    So now I send a Gcode:
    G01 X10.0000 Y25.0000 Z5.0000 E25.0000

    And every stepper moves the corresponding mm, which in my setup means 5120 steps/mm equals to e.g. my X-axis goes 10 mm Y-axix moves 25mm etc.

    Really nice. I am very satisfied.

    Below you have the entire modified file. I am not used to this, so I just put my name in the top. You should maybe change something. I have no intention to violate the GNU license.

    //
    
    // 4 Axis CNC Hot Wire Foam Cutter - supports MEGA 2560 Arduino RAMPS 1.4
    // dan@marginallyclever.com 2013-10-28
    // Modified by sorenvedel@gmail.com 2015-06-19
    //
    // Copyright at end of file.
    // please see http://www.github.com/MarginallyClever/GcodeCNCDemo for more information.


    //
    // CONSTANTS
    //
    //#define VERBOSE (1) // add to get a lot more serial output.

    #define VERSION (2) // firmware version
    #define BAUD (57600) // How fast is the Arduino talking?
    #define MAX_BUF (64) // What is the longest message Arduino can store?
    #define STEPS_PER_TURN (400) // depends on your stepper motor. most are 200.
    #define STEPS_PER_MM (STEPS_PER_TURN*16/1.25) // (400*16)/1.25 with a M8 spindle
    #define MAX_FEEDRATE (1000000)
    #define MIN_FEEDRATE (1)
    #define NUM_AXIES (4)


    //
    // STRUCTS
    //
    // for line()
    typedef struct {
    long delta; // number of steps to move
    long absdelta;
    long over; // for dx/dy bresenham calculations
    } Axis;


    typedef struct {
    int step_pin;
    int dir_pin;
    int enable_pin;
    int limit_switch_pin;
    } Motor;


    //
    // GLOBALS
    //
    Axis a[NUM_AXIES]; // for line()
    Axis atemp; // for line()
    Motor motors[NUM_AXIES];

    char buffer[MAX_BUF]; // where we store the message until we get a ';'
    int sofar; // how much is in the buffer

    // speeds
    float fr=0; // human version
    long step_delay; // machine version

    float px,py,pz,pe; // position

    // settings
    char mode_abs=1; // absolute mode?

    long line_number=0;


    //
    // METHODS
    //


    /**
    * delay for the appropriate number of microseconds
    * @input ms how many milliseconds to wait
    */
    void pause(long ms) {
    delay(ms/1000);
    delayMicroseconds(ms%1000); // delayMicroseconds doesn't work for values > ~16k.
    }


    /**
    * Set the feedrate (speed motors will move)
    * @input nfr the new speed in steps/second
    */
    void feedrate(float nfr) {
    if(fr==nfr) return; // same as last time? quit now.

    if(nfr>MAX_FEEDRATE || nfr<MIN_FEEDRATE) { // don't allow crazy feed rates
    Serial.print(F("New feedrate must be greater than "));
    Serial.print(MIN_FEEDRATE);
    Serial.print(F("steps/s and less than "));
    Serial.print(MAX_FEEDRATE);
    Serial.println(F("steps/s."));
    return;
    }
    step_delay = MAX_FEEDRATE/nfr;
    fr=nfr;
    }


    /**
    * Set the logical position
    * @input npx new position x
    * @input npy new position y
    */
    void position(float npx,float npy,float npz,float npe) {
    // here is a good place to add sanity tests
    px=npx;
    py=npy;
    pz=npz;
    pe=npe;
    }


    /**
    * Supports movement with both styles of Motor Shield
    * @input newx the destination x position
    * @input newy the destination y position
    **/
    void onestep(int motor) {
    #ifdef VERBOSE
    char *letter="XYZE";
    Serial.print(letter[]);
    #endif

    digitalWrite(motors[motor].step_pin,HIGH);
    digitalWrite(motors[motor].step_pin,LOW);
    }


    /**
    * Uses bresenham's line algorithm to move both motors
    * @input newx the destination x position
    * @input newy the destination y position
    **/
    void line(float newx,float newy,float newz,float newe) {
    a[0].delta = (newx-px)*STEPS_PER_MM;
    a[1].delta = (newy-py)*STEPS_PER_MM;
    a[2].delta = (newz-pz)*STEPS_PER_MM;
    a[3].delta = (newe-pe)*STEPS_PER_MM;

    long i,j,maxsteps=0;

    for(i=0;i<NUM_AXIES;++i) {
    a.absdelta = abs(a.delta);
    a
    .over=0;
    if( maxsteps < a
    .absdelta ) maxsteps = a.absdelta;
    // set the direction once per movement
    digitalWrite(motors
    .dir_pin,a.delta>0?HIGH:LOW);
    }

    long dt = MAX_FEEDRATE/5000;
    long accel = 1;
    long steps_to_accel = dt - step_delay;
    if(steps_to_accel > maxsteps/2 )
    steps_to_accel = maxsteps/2;

    long steps_to_decel = maxsteps - steps_to_accel;

    Serial.print("START ");
    Serial.println(dt);
    Serial.print("TOP ");
    Serial.println(step_delay);

    Serial.print("accel until ");
    Serial.println(steps_to_accel);
    Serial.print("decel after ");
    Serial.println(steps_to_decel);
    Serial.print("total ");
    Serial.println(maxsteps);
    #ifdef VERBOSE
    Serial.println(F("Start >"));
    #endif

    for( i=0; i<maxsteps; ++i ) {
    for(j=0;j<NUM_AXIES;++j) {
    a[j].over += a[j].absdelta;
    if(a[j].over >= maxsteps) {
    a[j].over -= maxsteps;

    digitalWrite(motors[j].step_pin,HIGH);
    digitalWrite(motors[j].step_pin,LOW);
    }
    }

    if(i<steps_to_accel) {
    dt -= accel;
    }
    if(i>=steps_to_decel) {
    dt += accel;
    }
    delayMicroseconds(dt);
    }

    #ifdef VERBOSE
    Serial.println(F("< Done."));
    #endif

    position(newx,newy,newz,newe);

    where();
    }


    // returns angle of dy/dx as a value from 0...2PI
    static float atan3(float dy,float dx) {
    float a=atan2(dy,dx);
    if(a<0) a=(PI*2.0)+a;
    return a;
    }



    /**
    * Look for character /code/ in the buffer and read the float that immediately follows it.
    * @return the value found. If nothing is found, /val/ is returned.
    * @input code the character to look for.
    * @input val the return value if /code/ is not found.
    **/
    float parsenumber(char code,float val) {
    char *ptr=buffer;
    while(ptr && *ptr && ptr<buffer+sofar) {
    if(*ptr==code) {
    return atof(ptr+1);
    }
    ptr=strchr(ptr,' ')+1;
    }
    return val;
    }


    /**
    * write a string followed by a float to the serial line. Convenient for debugging.
    * @input code the string.
    * @input val the float.
    */
    void output(char *code,float val) {
    Serial.print(code);
    Serial.println(val);
    }


    /**
    * print the current position, feedrate, and absolute mode.
    */
    void where() {
    output("X",px);
    output("Y",py);
    output("Z",pz);
    output("E",pe);
    output("F",fr);
    Serial.println(mode_abs?"ABS":"REL");
    }


    /**
    * display helpful information
    */
    void help() {
    Serial.print(F("GcodeCNCDemo6AxisV2 "));
    Serial.println(VERSION);
    Serial.println(F("Commands:"));
    Serial.println(F("G00/G01 [X/Y/Z/E(steps)] [F(feedrate)]; - linear move"));
    Serial.println(F("G04 P[seconds]; - delay"));
    Serial.println(F("G90; - absolute mode"));
    Serial.println(F("G91; - relative mode"));
    Serial.println(F("G92 [X/Y/Z/E(steps)]; - change logical position"));
    Serial.println(F("M18; - disable motors"));
    Serial.println(F("M100; - this help message"));
    Serial.println(F("M114; - report position and feedrate"));
    Serial.println(F("All commands must end with a newline."));
    }


    /**
    * Read the input buffer and find any recognized commands. One G or M command per line.
    */
    void processCommand() {
    int cmd = parsenumber('G',-1);
    switch(cmd) {
    case 0:
    case 1: { // line
    feedrate(parsenumber('F',fr));
    line( parsenumber('X',(mode_abs?px:0)) + (mode_abs?0:px),
    parsenumber('Y',(mode_abs?py:0)) + (mode_abs?0:py),
    parsenumber('Z',(mode_abs?pz:0)) + (mode_abs?0:pz),
    parsenumber('E',(mode_abs?pe:0)) + (mode_abs?0:pe) );
    break;
    }
    case 2:
    case 4: pause(parsenumber('P',0)*1000); break; // dwell
    case 90: mode_abs=1; break; // absolute mode
    case 91: mode_abs=0; break; // relative mode
    case 92: // set logical position
    position( parsenumber('X',0),
    parsenumber('Y',0),
    parsenumber('Z',0),
    parsenumber('E',0) );
    break;
    default: break;
    }

    cmd = parsenumber('M',-1);
    switch(cmd) {
    case 17: motor_enable(); break;
    case 18: motor_disable(); break;
    case 100: help(); break;
    case 114: where(); break;
    default: break;
    }
    }


    /**
    * prepares the input buffer to receive a new message and tells the serial connected device it is ready for more.
    */
    void ready() {
    sofar=0; // clear input buffer
    Serial.print(F(">")); // signal ready to receive input
    }


    /**
    * set up the pins for each motor
    */
    void motor_setup() {
    motors[0].step_pin=54;
    motors[0].dir_pin=55;
    motors[0].enable_pin=38;
    motors[0].limit_switch_pin=3;

    motors[1].step_pin=60;
    motors[1].dir_pin=61;
    motors[1].enable_pin=56;
    motors[1].limit_switch_pin=14;

    motors[2].step_pin=46;
    motors[2].dir_pin=48;
    motors[2].enable_pin=62;
    motors[2].limit_switch_pin=18;

    motors[3].step_pin=26;
    motors[3].dir_pin=28;
    motors[3].enable_pin=24;
    motors[3].limit_switch_pin=34;

    int i;
    for(i=0;i<NUM_AXIES;++i) {
    // set the motor pin & scale
    pinMode(motors
    .step_pin,OUTPUT);
    pinMode(motors
    .dir_pin,OUTPUT);
    pinMode(motors
    .enable_pin,OUTPUT);
    }
    }


    void motor_enable() {
    int i;
    for(i=0;i<NUM_AXIES;++i) {
    digitalWrite(motors
    .enable_pin,LOW);
    }
    }


    void motor_disable() {
    int i;
    for(i=0;i<NUM_AXIES;++i) {
    digitalWrite(motors
    .enable_pin,HIGH);
    }
    }


    /**
    * First thing this machine does on startup. Runs only once.
    */
    void setup() {
    Serial.begin(BAUD); // open coms

    motor_setup();
    motor_enable();


    where(); // for debugging purposes
    help(); // say hello
    position(0,0,0,0); // set starting position
    feedrate(1000); // set default speed
    ready();
    }


    /**
    * After setup() this machine will repeat loop() forever.
    */
    void loop() {
    // listen for serial commands
    while(Serial.available() > 0) { // if something is available
    char c=Serial.read(); // get it
    Serial.print(c); // repeat it back so I know you got the message
    if(sofar<MAX_BUF-1) buffer[sofar++]=c; // store it
    if(c=='n') {
    // entire message received
    // we got a message and it ends with a semicolon
    buffer[sofar]=0; // end the buffer so string functions work right
    Serial.print(F("rn")); // echo a return character for humans
    processCommand(); // do something with the command
    ready();
    }
    }
    }


    /**
    * This file is part of GcodeCNCDemo.
    *
    * GcodeCNCDemo is free software: you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation, either version 3 of the License, or
    * (at your option) any later version.
    *
    * GcodeCNCDemo is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with Foobar. If not, see .
    */
    #7052
    AvatarAnonymous
    Inactive
    #7053
    AvatarAnonymous
    Inactive

    Ok – Pull Request made after a lot of reading 😉

    Hope you survive in Russia and get home to your base again fit for fight.

    When will you come up with some news from Russia?

    #7054
    AvatarAnonymous
    Inactive

    Now it is working. Still miss a better power supply for the hot wire.

    http://www.rcgroups.com/forums/showthread.php?t=2388809

    #7055
    AvatarAnonymous
    Inactive

    The RAMPs board has a 12v rail for the hot bed on a 3d printer. Can you use that?

    #7056
    AvatarAnonymous
    Inactive

    Yes I have seen that, but I am not sure if it can produce enough power for a 0.2 mm Ni-Chrome wire of 120 cm length?

    According to this on-line calculator: http://www.jacobs-online.biz/nichrome/NichromeCalc.html

    My needs are big :-/

    I need 600 F degrees, 110 cm length, AWG 32 or 0.2 mm.

    The site recommends 35 V, 0.9 A,

    But my knowledge is limited on these matters. Probably this could be done otherwise, I have earlier used my 12V battery charger to cut very big foam pieces, so it might be. Maybe I should make a test with the Ramps board, because it could in many ways be a big advantage to use it to provide power for the wire, and I could be able to turn it on or off via Gcode when I wish to do that.

    Is there any risks to burn the Ramps board if I try it out?

    #7057
    AvatarAnonymous
    Inactive

    the ramps board handles up to 24v, but check the official ramps documentation.

    maybe one of these between the RAMPS board pins and the hot wire?
    http://www.prodctodc.com/120w-dcdc-1032v-to-3560v-boost-converter-laptop-notebook-car-power-supply-p-58.html

    Use a multimeter to adjust the output voltage for your needs.

    Not sure what you’ll do about the amperage.

    Do you really need exactly 35v? Is it a question of voltage or a question of temperature? I just wonder if you can achieve the same thing with 12v @ 2.7a (which would be the same # watts)

    #7058
    AvatarAnonymous
    Inactive

    Dan, you are a very clever guy!

    This looks just perfect and at an affordable price.

    As I am new to hot wire cutting, I guess that the most important factor to make a nice cut must be the ability to control the wire temperature.

    #7059
    AvatarAnonymous
    Inactive

    Then I’d get a thermistor on that wire to measure the temp and run a PID loop – auto turn power off when it’s too hot, turn power on when it’s too cold.

    #7060
    AvatarAnonymous
    Inactive

    Would it be possible not to turn on and off, but only increase/decrease volts or amps? So that the wire would have less fluctuations, or is this only a theoretical problem compared to what you suggest?

    #7061
    AvatarAnonymous
    Inactive

    There’s only one way to be sure. I know the 3d printers turn on and off very fast and don’t seem to care.

    #7062
    AvatarAnonymous
    Inactive

    Hi.
    I’m building CNC hot wire foam cutter with pull up wires and a bow. Concept from cnc-hotwire.de
    Electronics is working with GcodeCNCDemo4AxisRAMPS, just in wrong directions, but it is confirming motors are o.k.

    My setup is Arduino Mega2560, Ramps 1.4 and A4988 drivers.

    I was trying to use JHW for cutting, but the software is not communicating with ramps board. Available communication code is in HEX format, so I cant read it. It’s 5kb file simulating parallel port. I think it is written for UNO not MEGA.

    Is there some way to convert hex to ino and see what is in hex file?
    Or, is it possible to modify GcodeCNCDemo4AxisRAMPS so it would understand commands from JHW? I think it is sort of Gcode, but must be more simple, since JHW is doing calculations and requests steps from motors and not movement.

    I’m also waiting for few days for reply from JHW support, but not sure if or when I’ll get reply…

    #7063
    AvatarAnonymous
    Inactive

    Please post a sample of what JHW is sending and then people can compare to what GcodeCNCDemo expects.

    #7064
    AvatarAnonymous
    Inactive

    My attempts to spy on port failed, so I cant tell exactly. Also JHW freezes when directed to COM port which is not behaving as expected. It probably waits for some feedback..
    I think JHW is setup for sending data to parallel port and steeper controller box. I found this on web:

    If Arduino is used for simulating Parallel port to controller then this hex file is loaded to arduino:
    https://drive.google.com/open?id=0B9kuAWKjhhBaRm0xZS14NTBhQUk
    I think it is generated from this text file:
    https://drive.google.com/open?id=0B9kuAWKjhhBaMkQySy1ieFhaNkk

    Not sure what to do next…
    No reply from JHW support in this time

    #7065
    AvatarAnonymous
    Inactive
    #7066
    AvatarAnonymous
    Inactive

    just found this in manual, goes with image from previous post :

    Stepper motor control
    The JHW program has been developed at our Styroschneide in Model Club Rossendorf, which based on a MDLC CNC card works, a professional stepper motor controller for four uni- / bipolar stepper motors. This card has as an interface to the popular parallel port, ie the communication with the PC (ie JHW) must be running on this. JHW represents the cutting information (step c pulse and direction pulse d) each of the stepping motors M1, …, M4 via the PC parallel port interface with the pin assignment available shown here. The same pin assignment also uses the MDLC card. Have stepper motor controllers from other manufacturers also have a parallel port, there should be no problems, make an appropriate adjustment pin.

    #7067
    AvatarAnonymous
    Inactive

    Ah, well… GcodeCNCDemo does not run on a parallel port. I don’t know what it would take to adapt one to work with the other. :T

    #7068
    AvatarAnonymous
    Inactive

    I gave up on winch system.

    I wasn’t able to make JHW work with Ramps, only other software I know that supports 4 motor winch is LinuxCNC, but requires Linux 12 or older and my Windows 8 requires Linux 14 or newer, for dual system PC…

    So now after few days my Cartesian foam cutter is up and running… running to fast…
    I’ve put different F values in Gcode Sender but speed looks the same from F2 to F5000. It seems it only influence acceleration between points. I cant slow down the motors…

    Gcode is generated in Prolifi Pro.
    I’m using GcodeCNCDemo4AxisRAMPS with folowing definitions

    #define VERSION (2) // firmware version
    #define BAUD (57600) // How fast is the Arduino talking?
    #define MAX_BUF (64) // What is the longest message Arduino can store?
    #define STEPS_PER_TURN (1600) // depends on your stepper motor. most are 200. *8 for 1/8 microstepping
    #define STEPS_PER_MM (STEPS_PER_TURN/36.13) // diameter of the wheel is 11.5mm*pi
    #define MAX_FEEDRATE (1000000)
    #define MIN_FEEDRATE (1)
    #define NUM_AXIES (4)

    Am I missing something?
    Also motors stop and accelerate again on every point.

    #7069
    AvatarAnonymous
    Inactive

    Very probably the RAMPS version is out of date and doesn’t handle acceleration and delays well.
    The inner timing loops (look for keyword ‘ISR’) will be out of date compared to gcodecncdemoRUMBA or the Makelangelo-firmware.

    The big difference between the RAMPS and the RUMBA vesions are only two: number of stepper motors, and hardware pin setup. In theory both codes could be merged to reduce the workload.

    I can schedule time to look at this… november 8. might sneak it in before then, but not guaranteed. You are free to send me a pull request if you fix it yourself and I’ll put your name in the code as a contributor.

    #7070
    AvatarAnonymous
    Inactive

    I found solution and now it’s working…
    Although I don’t understand what is going on.

    I manage to slow down the motors by multiplying max feedrate by 50. in this case I could control speed through default speed settings in arduino code. F commands from gcode had effect only with huge numbers like 200000 or more. I fiddled around with numbers and found this line also had influence on speed:
    long dt = MAX_FEEDRATE/5000;
    after a lot of tests with different numbers I ended up with this:
    long dt = MAX_FEEDRATE/nfr;
    It cancels acceleration loop. It goes directly to desired speed in F code.
    I also put maxfeedrate back to 1000000.

    My CNC setup in belt drive, so rotation speed are relatively low and motor haves enough torque/power to jump to 3000 steps/s directly. Dont relay see I will use anything above 1000.
    Speed works correct on long straight lines. When cutting curves motors stop at each point waiting for next instruction from gcode sender. This is just a fraction of seconds, but having 1000 points it reduces average speed. Therefore I have to test each cut, but overall happy with results…

    #7071
    AvatarAnonymous
    Inactive

    The RUMBA board can buffer commands and look ahead, meaning it doesn’t hiccough when drawing G02 and G03 arcs.
    It will drive up to 6 axies. The gcodedemocnc supports RUMBA boards.
    https://www.marginallyclever.com/shop/control-boards/rumba-motion-controller-a4988-polulu-drivers

    #12619
    AvatarAnonymous
    Inactive

    Hello Guys!

    I’m also using this code for a hotwire cutting machine and developed a little VB interface for it (buttons for jogging and report position, GCode and etc).

    But I really would like to have more control over the feedrate values. So, could someone tell me why the line algorithm below would not work?

    Calculate Number of Steps: a[0].delta = (newx-px)*STEPS_PER_MM_X;
    Calculate time (in ms) required for 1 step: dt[0]=(60000/STEPS_PER_MM_X/fr); (feedrate is mm/min)
    Use this time to delay each pulse cycle.

    Example:
    Steps/mm=100
    FeedRate mm/min=200
    dt=6000/(100*200)= 3 milliseconds

    If axis is to travel 5mm, it will need 500 steps pulsed in intervals of 3 milliseconds, giving a total travel time of 1.5 seconds (which corresponds to the feedrate of 200mm/min):

    void line(float newx,float newy,float newu,float newz) {
      a[0].delta = (newx-px)*STEPS_PER_MM_X;
      a[1].delta = (newy-py)*STEPS_PER_MM_Y;
      a[2].delta = (newu-pu)*STEPS_PER_MM_U;
      a[3].delta = (newz-pz)*STEPS_PER_MM_Z; // Gives number of steps
        
      dt[0]=(60000/STEPS_PER_MM_X/fr);
      dt[1]=(60000/STEPS_PER_MM_Y/fr);
      dt[2]=(60000/STEPS_PER_MM_U/fr);
      dt[3]=(60000/STEPS_PER_MM_Z/fr); //Time for 1 step in milliseconds
    
        long i,j,maxsteps=0;
    	int index;
    	
      for(i=0;i<NUM_AXIES;++i) {
        a[i].absdelta = abs(a[i].delta);
        if( maxsteps < a[i].absdelta ) maxsteps = a[i].absdelta;
    	// set the direction once per movement
        digitalWrite(motor[i].dir_pin,a[i].delta>0?HIGH:LOW);
      }
      for(i=0;i<NUM_AXIES;++i) {
        a[i].over= maxsteps/2;
      }
    
      for( i=0; i<maxsteps; ++i ) {
        for(j=0;j<NUM_AXIES;++j) {
          a[j].over += a[j].absdelta;
          if(a[j].over >= maxsteps) {
            index=j;                       // index of motor being pulsed is stored
    		a[j].over -= maxsteps;
    		digitalWrite(motor[j].step_pin,HIGH);
            digitalWrite(motor[j].step_pin,LOW);
          }
        }
    	delay(dt[index]);             // delay is applied according to the motor that is being pulsed 
      }
    
      position(newx,newy,newu,newz);
    }
    #12620
    DanDan
    Keymaster

    a/b/c – which one gets divided first?

Viewing 25 posts - 1 through 25 (of 27 total)
  • You must be logged in to reply to this topic.