FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    ARDUINO-based mini CNC 2D plotter

     

    "The project is based Arduino mini CNC 2D plotter, the plotter controlled X-axis and the Y axis motor 2, and a servomotor controlled handmade Z-axis carriage. Project presentations: Be Required hardware: Arduino Mega 2560 L293D motor control with the cover Miniature Servo EMAX ES08MA II Stepper motor Schematic: Code: // turn on debug mode // #define DEBUG // servo library #include // ADAFRUIT MOTOR SHIELD library #include // Pin const int z_pin = 9; //Location const int z_up = 0; const int z_dn = 35; // Set Drawing const char STEP = INTERLEAVE; const float x_steps_per_mm = 13 .4; const float y_steps_per_mm = 13 .4; //delay const int step_delay_up = 2; const int step_delay_dn = 5; const int move_delay = 100; const int pen_delay = 250; // limit [mm] const float x_min = 0; const float x_max = 40; const float y_min = 0; const float y_max = 40; // read const int line_size = 80; // stepping motor (STEPS / REV, NUMBER) AF_Stepper x_motor (48,1); AF_Stepper y_motor (48,2); Servo z_motor; // Location Float x = x_min; Floating point y = y_min; int z = 0; // read int line_index = 0; Character lines [line_size]; Boolean = False ignored; // ------------------------------------------------ ---------------------------- // // function (SETUP) // // ------------------------------------------------ ---------------------------- // Invalid setting () { // initialize serial communication Serial.begin (38400); // Reset position Reset (); #ifdef debug Serial.println (); Serial.println ( "MiniPlotter still running!"); Serial.println (); Serial.print ( "X from"); Serial.print (x_min); Serial.print ( "to"); Serial.print (x_max); Serial.println ( "mm"); Serial.print ( "Y from"); Serial.print (y_min); Serial.print ( "to"); Serial.print (y_max); Serial.println ( "mm"); Serial.println (); #just in case } void reset () { move_z (0); move_z (1); move_z (0); move_xy (x_min, y_min); move_xy (x_max, y_max); move_z (1); move_z (0); move_xy (x_min, y_min); } // ------------------------------------------------ ---------------------------- // // function (READ) // // ------------------------------------------------ ---------------------------- // Invalid read_serial () { Character c; And (Serial.available ()) { c = Serial.read (); #ifdef debug Serial.print ( "read characters:"); Serial.println (c); #just in case If (c == '\ n' || c == '\ r') { // reach the end of the line If (line_index> 0) { Line [line_index] = '\ 0'; #ifdef debug Serial.print ( "read:"); Serial.println (OK); Serial.println (); #just in case process_line (line, line_index); line_index = 0; } other { #ifdef debug Serial.println ( "blank line"); Serial.println (); #just in case } Ignore = false; } other { If the (ignored) { If (c == ')') { // stop ignoring row Ignore = false; } } other { If (c <= '') { // throw away the white space and control characters } Else if (c == '/') { // delete does not support block, ignoring character } Else if (c == '(') { // ignore the start line Ignore = true; } Else if (c == ';') { // do not support SEMICOLON, ignore line Ignore = true; } Else if (line_index> = line_size- 1) { Serial.println ( "Error: Line size exceeded"); Ignore = false; } Else if (c> = 'a' && c <= 'z') { // to UPCASE line [line_index ++] = c - 'a' + 'A'; } other { Line [line_index ++] = c; } } } } } Invalid process_line (char * line, int line_size) { int line_index = 0; Char buffer [50]; #ifdef debug Serial.print ( "processing of the line:"); Serial.println (OK); Serial.println ( ""); #just in case And (line_index z"); Serial.Println (z_pos); Serial.Println (""); #just in case // move If (z_pos! = Z) { Motors_attach_detach (0); If (z_pos == 0) { Z_motor.write (z_UP); } other { Z_motor.write (z_dn); } Delay (Pen_DELAY); Motors_attach_detach (1); } // Update location Z = z_pos; } Void Move_xy (float x_pos, float y_pos) { // x_pos, y_pos: x and y position #IfDef debugging Serial.Print ("Move: X"); Serial.Print (x); Serial.Print ("y"); Serial.Print (Y); Serial.Print ("=> x"); Serial.print (x_pos); Serial.Print ("y"); Serial.Println (Y_POS); Serial.Println (""); #just in case // Adjust position to the limit If (x_pos> = x_max) { X_POS = X_max; } If (x_pos <= x_min) { X_POS = X_MIN; } If (y_pos> = y_max) { Y_POS = y_max; } If (y_pos <= y_min) { Y_POS = y_min; } // Convert to step Floating point x_step = (int) (x * x_steps_per_mm); Floating point y_step = (int) (Y * Y_STEPS_PER_MM); Floating point X_POS_STEP = (int) (x_pos * x_steps_per_mm); Floating point Y_POS_STEP = (int) (y_pos * y_steps_per_mm); // Calculated changes Long DX = ABS (X_POS_STEP-X_STEP); Long DY = ABS (Y_POS_STEP-Y_STEP); INT SX = X_STEP DY) { For (INT I = 0; i = dx) { More than - = DX; Y_motor.onestep (Sy, STEP); } If (z == 0) { Delay (Step_Delay_UP); } other { Delay (Step_delay_DN); } } } other { For (int i = 0; i = DY) { More than - = DY; X_motor.oneStep (SX, STEP); } If (z == 0) { Delay (Step_Delay_UP); } other { Delay (Step_delay_DN); } } } Delay (Move_DELAY); // Update location X = x_pos; Y = y_pos; } / / -------------------------------------------------------------------------------------------- ---------------------------- // // Function (PLOT)

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us