Тёмный
No video :(

إصنع طابعة CNC بالاردوينو - how to make a CNC whit arduino 

pro-creativity
Подписаться 1,9 тыс.
Просмотров 3,2 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@pro-creativity4471
@pro-creativity4471 8 месяцев назад
كود الاردوينو #include #include #define LINE_BUFFER_LENGTH 512 char STEP = MICROSTEP ; // Servo position for Up and Down const int penZUp = 120; const int penZDown = 50; // Servo on PWM pin 10 const int penServoPin =10 ; // Should be right for DVD steppers, but is not too important here const int stepsPerRevolution = 48; // create servo object to control a servo Servo penServo; // Initialize steppers for X- and Y-axis using this Arduino pins for the L293D H-bridge AF_Stepper myStepperY(stepsPerRevolution,1); AF_Stepper myStepperX(stepsPerRevolution,2); /* Structures, global variables */ struct point { float x; float y; float z; }; // Current position of plothead struct point actuatorPos; // Drawing settings, should be OK float StepInc = 1; int StepDelay = 1; int LineDelay =0; int penDelay = 50; // Motor steps to go 1 millimeter. // Use test sketch to go 100 steps. Measure the length of line. // Calculate steps per mm. Enter here. float StepsPerMillimeterX = 100.0; float StepsPerMillimeterY = 100.0; // Drawing robot limits, in mm // OK to start with. Could go up to 50 mm if calibrated well. float Xmin = -20; float Xmax =20; float Ymin = -20; float Ymax = 20; float Zmin = 0; float Zmax = 1; float Xpos = Xmin; float Ypos = Ymin; float Zpos = Zmax; // Set to true to get debug output. boolean verbose = false; // Needs to interpret // G1 for moving // G4 P300 (wait 150ms) // M300 S30 (pen down) // M300 S50 (pen up) // Discard anything with a ( // Discard any other command! /********************** * void setup() - Initialisations ***********************/ void setup() { // Setup Serial.begin( 9600 ); penServo.attach(penServoPin); penServo.write(penZUp); delay(100); // Decrease if necessary myStepperX.setSpeed(600); myStepperY.setSpeed(600); // Set & move to initial default position // TBD // Notifications!!! Serial.println("Mini CNC Plotter alive and kicking!"); Serial.print("X range is from "); Serial.print(Xmin); Serial.print(" to "); Serial.print(Xmax); Serial.println(" mm."); Serial.print("Y range is from "); Serial.print(Ymin); Serial.print(" to "); Serial.print(Ymax); Serial.println(" mm."); } /********************** * void loop() - Main loop ***********************/ void loop() { delay(100); char line[ LINE_BUFFER_LENGTH ]; char c; int lineIndex; bool lineIsComment, lineSemiColon; lineIndex = 0; lineSemiColon = false; lineIsComment = false; while (1) { // Serial reception - Mostly from Grbl, added semicolon support while ( Serial.available()>0 ) { c = Serial.read(); if (( c == ' ') || (c == ' ') ) { // End of line reached if ( lineIndex > 0 ) { // Line is complete. Then execute! line[ lineIndex ] = '\0'; // Terminate string if (verbose) { Serial.print( "Received : "); Serial.println( line ); } processIncomingLine( line, lineIndex ); lineIndex = 0; } else { // Empty or comment line. Skip block. } lineIsComment = false; lineSemiColon = false; Serial.println("ok"); } else { if ( (lineIsComment) || (lineSemiColon) ) { // Throw away all comment characters if ( c == ')' ) lineIsComment = false; // End of comment. Resume line. } else { if ( c = LINE_BUFFER_LENGTH-1 ) { Serial.println( "ERROR - lineBuffer overflow" ); lineIsComment = false; lineSemiColon = false; } else if ( c >= 'a' && c
@abuhamza6817
@abuhamza6817 7 месяцев назад
ما شاء الله، نفخر بهذه الابداعات العربية و الإسلامية ❤
@lamariabderezak3976
@lamariabderezak3976 8 месяцев назад
ماشاء الله روعة الله يبارك .
@elhassan-elomari
@elhassan-elomari 8 месяцев назад
Keep going brother. yes you are really so good
@user-eh5sf7he5j
@user-eh5sf7he5j 8 месяцев назад
اكثر من رائع احسنت ❤❤
@AliMGK-kf8zm
@AliMGK-kf8zm 5 месяцев назад
جزاك الله خيراً
@user-km2xb5yy3u
@user-km2xb5yy3u 4 месяца назад
ممتاز ومشكور جدا
@pro-creativity4471
@pro-creativity4471 8 месяцев назад
كود البروسيسينغ processing 3 import java.awt.event.KeyEvent; import javax.swing.JOptionPane; import processing.serial.*; Serial port = null; // select and modify the appropriate line for your operating system // leave as null to use interactive port (press 'p' in the program) String portname = null; //String portname = Serial.list()[0]; // Mac OS X //String portname = "/dev/ttyUSB0"; // Linux //String portname = "COM5"; // Windows boolean streaming = false; float speed = 0.001; String[] gcode; int i = 0; void openSerialPort() { if (portname == null) return; if (port != null) port.stop(); port = new Serial(this, portname, 9600); port.bufferUntil(' '); } void selectSerialPort() { String result = (String) JOptionPane.showInputDialog(frame, "Select the serial port that corresponds to your Arduino board.", "Select serial port", JOptionPane.PLAIN_MESSAGE, null, Serial.list(), 0); if (result != null) { portname = result; openSerialPort(); } } void setup() { size(500, 250); openSerialPort(); } void draw() { background(0); fill(255); int y = 24, dy = 12; text("INSTRUCTIONS", 12, y); y += dy; text("p: select serial port", 12, y); y += dy; text("arrow keys: jog in x-y plane", 12, y); y += dy; text("5 & 2: jog in z axis", 12, y); y += dy; text("$: display grbl settings", 12, y); y+= dy; text("h: go home", 12, y); y += dy; text("0: zero machine (set home to the current location)", 12, y); y += dy; text("g: stream a g-code file", 12, y); y += dy; text("x: stop streaming g-code (this is NOT immediate)", 12, y); y += dy; y = height - dy; text("current jog speed: " + speed + " inches per step", 12, y); y -= dy; text("current serial port: " + portname, 12, y); y -= dy; } void keyPressed() { if (key == '1') speed = 0.001; if (key == '2') speed = 0.01; if (key == '3') speed = 0.1; if (!streaming) { if (keyCode == LEFT) port.write("G21/G90/G1 X-10 F3500 "); if (keyCode == RIGHT) port.write("G21/G90/G1 X10 F3500 "); if (keyCode == UP) port.write("G21/G90/G1 Y10 F3500 "); if (keyCode == DOWN) port.write("G21/G90/G1 Y-10 F3500 "); if (key == '5') port.write("M300 S50 "); if (key == '2') port.write("M300 S30 "); if (key == 'h') port.write("G90 G20 G00 X0.000 Y0.000 Z0.000 "); if (key == 'v') port.write("$0=75 $1=74 $2=75 "); //if (key == 'v') port.write("$0=100 $1=74 $2=75 "); if (key == 's') port.write("$3=10 "); if (key == 'e') port.write("$16=1 "); if (key == 'd') port.write("$16=0 "); if (key == '0') openSerialPort(); if (key == 'p') selectSerialPort(); if (key == '$') port.write("$$ "); } if (!streaming && key == 'g') { gcode = null; i = 0; File file = null; println("Loading file..."); selectInput("Select a file to process:", "fileSelected", file); } if (key == 'x') streaming = false; } void fileSelected(File selection) { if (selection == null) { println("Window was closed or the user hit cancel."); } else { println("User selected " + selection.getAbsolutePath()); gcode = loadStrings(selection.getAbsolutePath()); if (gcode == null) return; streaming = true; stream(); } } void stream() { if (!streaming) return; while (true) { if (i == gcode.length) { streaming = false; return; } if (gcode[i].trim().length() == 0) i++; else break; } println(gcode[i]); port.write(gcode[i] + ' '); i++; } void serialEvent(Serial p) { String s = p.readStringUntil(' '); println(s.trim()); if (s.trim().startsWith("ok")) stream(); if (s.trim().startsWith("error")) stream(); // XXX: really? }
Далее
Cristiano Ronaldo Surpassed Me! #shorts
00:17
Просмотров 11 млн
Cute kitty gadget 💛💕
00:23
Просмотров 6 млн
Arduino Fire Fighting Robot| RRX Tech |
10:31
Просмотров 18 тыс.
The coolest robot I've ever built!
19:40
Просмотров 4,6 млн