Search

Ramps Test Code

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Tony Davies Tony Davies 10 months, 1 week ago.

  • Author
    Posts
  • #1147
    Profile photo of Tony Davies
    Tony Davies
    Participant

    Hi guys

    If you are having trouble with setting up your 3D printer and want to test the motors before uploading Marlin then here is some code to run the motors- it will also be available in the downloads area in arduino sketch format,

    The Code

    #define X_STEP_PIN         54

    #define X_DIR_PIN          55

    #define X_ENABLE_PIN       38

    #define X_MIN_PIN           3

    #define X_MAX_PIN           2

     

    #define Y_STEP_PIN         60

    #define Y_DIR_PIN          61

    #define Y_ENABLE_PIN       56

    #define Y_MIN_PIN          14

    #define Y_MAX_PIN          15

     

    #define Z_STEP_PIN         46

    #define Z_DIR_PIN          48

    #define Z_ENABLE_PIN       62

    #define Z_MIN_PIN          18

    #define Z_MAX_PIN          19

     

    #define E_STEP_PIN         26

    #define E_DIR_PIN          28

    #define E_ENABLE_PIN       24

     

    #define Q_STEP_PIN         36

    #define Q_DIR_PIN          34

    #define Q_ENABLE_PIN       30

     

    #define SDPOWER            -1

    #define SDSS               53

    #define LED_PIN            13

     

    #define FAN_PIN            9

     

    #define PS_ON_PIN          12

    #define KILL_PIN           -1

     

    #define HEATER_0_PIN       10

    #define HEATER_1_PIN       8

    #define TEMP_0_PIN          13   // ANALOG NUMBERING

    #define TEMP_1_PIN          14   // ANALOG NUMBERING

     

    void setup() {

    pinMode(FAN_PIN , OUTPUT);

    pinMode(HEATER_0_PIN , OUTPUT);

    pinMode(HEATER_1_PIN , OUTPUT);

    pinMode(LED_PIN  , OUTPUT);

     

    pinMode(X_STEP_PIN  , OUTPUT);

    pinMode(X_DIR_PIN    , OUTPUT);

    pinMode(X_ENABLE_PIN    , OUTPUT);

     

    pinMode(Y_STEP_PIN  , OUTPUT);

    pinMode(Y_DIR_PIN    , OUTPUT);

    pinMode(Y_ENABLE_PIN    , OUTPUT);

     

    pinMode(Z_STEP_PIN  , OUTPUT);

    pinMode(Z_DIR_PIN    , OUTPUT);

    pinMode(Z_ENABLE_PIN    , OUTPUT);

     

    pinMode(E_STEP_PIN  , OUTPUT);

    pinMode(E_DIR_PIN    , OUTPUT);

    pinMode(E_ENABLE_PIN    , OUTPUT);

     

    pinMode(Q_STEP_PIN  , OUTPUT);

    pinMode(Q_DIR_PIN    , OUTPUT);

    pinMode(Q_ENABLE_PIN    , OUTPUT);

     

    digitalWrite(X_ENABLE_PIN    , LOW);

    digitalWrite(Y_ENABLE_PIN    , LOW);

    digitalWrite(Z_ENABLE_PIN    , LOW);

    digitalWrite(E_ENABLE_PIN    , LOW);

    digitalWrite(Q_ENABLE_PIN    , LOW);

    }

     

     

     

     

     

    void loop () {

     

    if (millis() %1000 <500)

    digitalWrite(LED_PIN, HIGH);

    else

    digitalWrite(LED_PIN, LOW);

     

    if (millis() %1000 <300) {

    digitalWrite(HEATER_0_PIN, HIGH);

    digitalWrite(HEATER_1_PIN, LOW);

    digitalWrite(FAN_PIN, LOW);

    } else if (millis() %1000 <600) {

    digitalWrite(HEATER_0_PIN, LOW);

    digitalWrite(HEATER_1_PIN, HIGH);

    digitalWrite(FAN_PIN, LOW);

    } else  {

    digitalWrite(HEATER_0_PIN, LOW);

    digitalWrite(HEATER_1_PIN, LOW);

    digitalWrite(FAN_PIN, HIGH);

    }

     

    if (millis() %10000 <5000) {

    digitalWrite(X_DIR_PIN    , HIGH);

    digitalWrite(Y_DIR_PIN    , HIGH);

    digitalWrite(Z_DIR_PIN    , HIGH);

    digitalWrite(E_DIR_PIN    , HIGH);

    digitalWrite(Q_DIR_PIN    , HIGH);

    }

    else {

    digitalWrite(X_DIR_PIN    , LOW);

    digitalWrite(Y_DIR_PIN    , LOW);

    digitalWrite(Z_DIR_PIN    , LOW);

    digitalWrite(E_DIR_PIN    , LOW);

    digitalWrite(Q_DIR_PIN    , LOW);

    }

     

     

    digitalWrite(X_STEP_PIN    , HIGH);

    digitalWrite(Y_STEP_PIN    , HIGH);

    digitalWrite(Z_STEP_PIN    , HIGH);

    digitalWrite(E_STEP_PIN    , HIGH);

    digitalWrite(Q_STEP_PIN    , HIGH);

    delay(1);

     

    digitalWrite(X_STEP_PIN    , LOW);

    digitalWrite(Y_STEP_PIN    , LOW);

    digitalWrite(Z_STEP_PIN    , LOW);

    digitalWrite(E_STEP_PIN    , LOW);

    digitalWrite(Q_STEP_PIN    , LOW);

     

    }

     

    Cheers

You must be logged in to reply to this topic.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •