نمایش نتایج: از 1 به 6 از 6
Like Tree1 لایک
  • 1 Post By magmagmary

موضوع: شیلد درایور cnc ورژن 3

  1. #1
    مدیر گروه
    تاریخ عضویت
    Nov 2013
    محل سکونت
    ایران
    نوشته ها
    4,064

    شیلد درایور cnc ورژن 3

    نمونه کد اردوینو :

    کد:
    # define EN 8 / / stepper motor enable , active low
    # define X_DIR 5 / / X -axis stepper motor direction control
    # define Y_DIR 6 / / y -axis stepper motor direction control
    # define Z_DIR 7 / / z axis stepper motor direction control
    # define X_STP 2 / / x -axis stepper control
    # define Y_STP 3 / / y -axis stepper control
    # define Z_STP 4 / / z -axis stepper control
    / *
    / / Function : step . function: to control the direction of the stepper motor , the number of steps .
    / / Parameters : dir direction control , dirPin corresponding stepper motor DIR pin , stepperPin corresponding stepper motor " step " pin , Step number of step of no return value.
    
    
    * /
    void step (boolean dir, byte dirPin, byte stepperPin, int steps)
    {
    digitalWrite (dirPin, dir);
    delay (50);
    for (int i = 0; i digitalWrite (stepperPin, HIGH);
    delayMicroseconds (800);
    digitalWrite (stepperPin, LOW);
    delayMicroseconds (800);
    }
    }
    void setup () {/ / The stepper motor used in the IO pin is set to output
    pinMode (X_DIR, OUTPUT); pinMode (X_STP, OUTPUT);
    pinMode (Y_DIR, OUTPUT); pinMode (Y_STP, OUTPUT);
    pinMode (Z_DIR, OUTPUT); pinMode (Z_STP, OUTPUT);
    pinMode (EN, OUTPUT);
    digitalWrite (EN, LOW);
    }
    void loop () {
    step (false, X_DIR, X_STP, 200); / / X axis motor reverse 1 ring, the 200 step is a circle.
    step (false, Y_DIR, Y_STP, 200); / / y axis motor reverse 1 ring, the 200 step is a circle.
    step (false, Z_DIR, Z_STP, 200); / / z axis motor reverse 1 ring, the 200 step is a circle.
    delay (1000);
    step (true, X_DIR, X_STP, 200); / / X axis motor forward 1 laps, the 200 step is a circle.
    step (true, Y_DIR, Y_STP, 200); / / y axis motor forward 1 laps, the 200 step is a circle.
    step (true, Z_DIR, Z_STP, 200); / / z axis motor forward 1 laps, the 200 step is a circle.
    delay (1000);
    }
    لایک کردن

  2. #2
    Junior Member
    تاریخ عضویت
    Feb 2016
    نوشته ها
    12
    دستور for در تابع step ناقص نوشته شده است. برنامه کامل در این لینک موجود هست.
    ویرایش توسط farrokh : 12-13-2016 در ساعت 04:32 PM

  3. #3
    Junior Member
    تاریخ عضویت
    Sep 2016
    محل سکونت
    GB
    نوشته ها
    24
    #define EN 8 // stepper motor enable , active low
    #define X_DIR 5 // X -axis stepper motor direction control
    #define Y_DIR 6 // y -axis stepper motor direction control
    #define Z_DIR 7 // z axis stepper motor direction control
    #define X_STP 2 // x -axis stepper control
    #define Y_STP 3 // y -axis stepper control
    #define Z_STP 4 // z -axis stepper control
    /*
    // Function : step . function: to control the direction of the stepper motor , the number of steps .
    // Parameters : dir direction control , dirPin corresponding stepper motor DIR pin , stepperPin corresponding stepper motor " step " pin , Step number of step of no return value.
    */
    void step (boolean dir, byte dirPin, byte stepperPin, int steps)
    {
    digitalWrite (dirPin, dir);
    delay (50);
    for (int i = 0; i < steps; i++) {
    digitalWrite (stepperPin, HIGH);
    delayMicroseconds (800);
    digitalWrite (stepperPin, LOW);
    delayMicroseconds (800);
    }
    }

    void setup () {// The stepper motor used in the IO pin is set to output
    pinMode (X_DIR, OUTPUT); pinMode (X_STP, OUTPUT);
    pinMode (Y_DIR, OUTPUT); pinMode (Y_STP, OUTPUT);
    pinMode (Z_DIR, OUTPUT); pinMode (Z_STP, OUTPUT);
    pinMode (EN, OUTPUT);
    digitalWrite (EN, LOW);
    }
    void loop () {
    step (false, X_DIR, X_STP, 200); // X axis motor reverse 1 ring, the 200 step is a circle.
    step (false, Y_DIR, Y_STP, 200); // y axis motor reverse 1 ring, the 200 step is a circle.
    step (false, Z_DIR, Z_STP, 200); // z axis motor reverse 1 ring, the 200 step is a circle.
    delay (1000);
    step (true, X_DIR, X_STP, 200); // X axis motor forward 1 laps, the 200 step is a circle.
    step (true, Y_DIR, Y_STP, 200); // y axis motor forward 1 laps, the 200 step is a circle.
    step (true, Z_DIR, Z_STP, 200); // z axis motor forward 1 laps, the 200 step is a circle.
    delay (1000);
    }

  4. #4
    Junior Member
    تاریخ عضویت
    Feb 2016
    نوشته ها
    12
    من میخوام همراه با کد بالا سرعت استپ موتور رو با دستور setSpeed هم کنترل کنم. نمیدونم چطوری باید این دستور و شی مورد نظر رو بنویسم. ممنون میشم کمک کنید.

  5. #5
    مدیر ویژه
    تاریخ عضویت
    May 2014
    نوشته ها
    259
    نقل قول نوشته اصلی توسط farrokh نمایش پست ها
    من میخوام همراه با کد بالا سرعت استپ موتور رو با دستور setSpeed هم کنترل کنم. نمیدونم چطوری باید این دستور و شی مورد نظر رو بنویسم. ممنون میشم کمک کنید.


    void step(boolean dir, byte dirPin, byte stepperPin, int steps, long speed)
    {
    digitalWrite(dirPin, dir);
    delay(50);
    for (int i = 0; i < steps; i++)
    digitalWrite(stepperPin, HIGH);
    delayMicroseconds(800);
    digitalWrite(stepperPin, LOW);
    delayMicroseconds(speed);
    }
    }
    void setup() {
    / / The stepper motor used in the IO pin is set to output
    pinMode(X_DIR, OUTPUT); pinMode(X_STP, OUTPUT);
    pinMode(EN, OUTPUT);
    digitalWrite(EN, LOW);
    }
    void loop() {
    step(false, X_DIR, X_STP, 200. 15); / / X axis motor reverse 1 ring, the 200 step is a circle.

    }

  6. #6
    Junior Member
    تاریخ عضویت
    Jun 2017
    نوشته ها
    1
    سلام من یه استپر موتور 12 ولت 5 سیمه 28BYJ-48 دارم و این شیلد رو با درایور Reprap A4988 برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: Reprap-A4988 (3)-500x500.jpg
مشاهده: 174
حجم: 38.6 کیلو بایت
    ولی روی این شیلد فقط جای چهار تا سیم داره ، چکار کنم ؟ ممنون

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •  

SEO by vBSEO