Created
March 17, 2016 17:20
-
-
Save erwincoumans/7433a9ea7951932b9d79 to your computer and use it in GitHub Desktop.
Dobot control using RAMPS 1.4 shield with Arduino Mega
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is taken from https://www.reddit.com/r/Dobot/comments/45ilan/controlling_dobot_with_ramps_14 | |
#include <AccelStepper.h> | |
#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 | |
#define TEMP_1_PIN 14 | |
#define zPlus 40 | |
#define zMinus 42 | |
int j = 0; | |
float x,y,z,h; | |
char junk; | |
AccelStepper HornaRuka(1, X_STEP_PIN, X_DIR_PIN); | |
AccelStepper DolnaRuka(1, Y_STEP_PIN, Y_DIR_PIN); | |
AccelStepper Tocna(1, Z_STEP_PIN, Z_DIR_PIN); | |
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); | |
pinMode(zPlus, INPUT_PULLUP); | |
pinMode(zMinus, INPUT_PULLUP); | |
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); | |
HornaRuka.setMaxSpeed(2000); | |
HornaRuka.setSpeed(8000); | |
HornaRuka.setAcceleration(2000); | |
DolnaRuka.setMaxSpeed(2000); | |
DolnaRuka.setSpeed(8000); | |
DolnaRuka.setAcceleration(2000); | |
Tocna.setMaxSpeed(2000); | |
Tocna.setSpeed(8000); | |
Tocna.setAcceleration(2000); | |
Serial.begin(9600); | |
} | |
void loop () { | |
DolnaRuka.moveTo(1000); | |
HornaRuka.moveTo(1000); | |
Tocna.moveTo(1000); | |
while(DolnaRuka.distanceToGo()!=0||HornaRuka.distanceToGo()!=0||Tocna.distanceToGo()!=0){ | |
DolnaRuka.run(); | |
HornaRuka.run(); | |
Tocna.run();} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is taken from https://www.reddit.com/r/Dobot/comments/45ilan/controlling_dobot_with_ramps_14 | |
#include <AccelStepper.h> | |
#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 | |
#define TEMP_1_PIN 14 | |
#define zPlus 40 | |
#define zMinus 42 | |
int j = 0; | |
float x,y,z,h; | |
char junk; | |
AccelStepper HornaRuka(1, X_STEP_PIN, X_DIR_PIN); | |
AccelStepper DolnaRuka(1, Y_STEP_PIN, Y_DIR_PIN); | |
AccelStepper Tocna(1, Z_STEP_PIN, Z_DIR_PIN); | |
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); | |
pinMode(zPlus, INPUT_PULLUP); | |
pinMode(zMinus, INPUT_PULLUP); | |
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); | |
HornaRuka.setMaxSpeed(2000); | |
HornaRuka.setSpeed(8000); | |
HornaRuka.setAcceleration(2000); | |
DolnaRuka.setMaxSpeed(2000); | |
DolnaRuka.setSpeed(8000); | |
DolnaRuka.setAcceleration(2000); | |
Tocna.setMaxSpeed(2000); | |
Tocna.setSpeed(8000); | |
Tocna.setAcceleration(2000); | |
Serial.begin(9600); | |
} | |
void loop () { | |
DolnaRuka.moveTo(1000); | |
HornaRuka.moveTo(1000); | |
Tocna.moveTo(1000); | |
while(DolnaRuka.distanceToGo()!=0||HornaRuka.distanceToGo()!=0||Tocna.distanceToGo()!=0){ | |
DolnaRuka.run(); | |
HornaRuka.run(); | |
Tocna.run();} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment