diff options
Diffstat (limited to 'Other_Arduino_Codes/TwoNEMA17-2DM542Test')
-rw-r--r-- | Other_Arduino_Codes/TwoNEMA17-2DM542Test/Readme | 12 | ||||
-rw-r--r-- | Other_Arduino_Codes/TwoNEMA17-2DM542Test/TwoNEMA17-2DM542Test.ino | 114 |
2 files changed, 126 insertions, 0 deletions
diff --git a/Other_Arduino_Codes/TwoNEMA17-2DM542Test/Readme b/Other_Arduino_Codes/TwoNEMA17-2DM542Test/Readme new file mode 100644 index 0000000..46a2a82 --- /dev/null +++ b/Other_Arduino_Codes/TwoNEMA17-2DM542Test/Readme @@ -0,0 +1,12 @@ +This code is meant to test NEMA 17 motors with 2DM542 (microstep driver). The connections are as under: + +1. The pins A+ A- B+ and B- are connected with the four pins of NEMA17. +2. V+ and GND are connected to 24V power supply terminals. GND is shorted with the GND of Arduino. +3. ENA- DIR- and PLS- are connected to GND of Arduino. +4. PLS+ --> D10 of Arduino. +5. DIR+ --> D11 of Arduino. +6. ENA+ --> D12 of Arduino. +7. RS232 pins were completely OFF. +8. The swicthes on the driver were adjusted for 3200 steps per revolution and 1A current supply. + +This code makes the two motors NEMA 17 run only once for 180 degrees (one after another). diff --git a/Other_Arduino_Codes/TwoNEMA17-2DM542Test/TwoNEMA17-2DM542Test.ino b/Other_Arduino_Codes/TwoNEMA17-2DM542Test/TwoNEMA17-2DM542Test.ino new file mode 100644 index 0000000..3f0af63 --- /dev/null +++ b/Other_Arduino_Codes/TwoNEMA17-2DM542Test/TwoNEMA17-2DM542Test.ino @@ -0,0 +1,114 @@ +int stepPin = 12; +int dirPin = 11; +int enblPin = 10; + +int LASER = 3; + +int stepPin1 = 9; +int dirPin1 = 8; +int enblPin1 = 7; +//int mosfet1=3; +//int mosfet2=5; +int delayy = 5; +int Relay1 = 2; +int Relay2 = 4; +int Relay3 = 5; +int Relay4 = 6; + +void setup() { + Serial.begin(9600); + //pinMode(mosfet1, OUTPUT); + //pinMode(mosfet2, OUTPUT); + //digitalWrite(mosfet1, LOW); + + //digitalWrite(mosfet2, LOW); +//delay(5000); + + //for(int i =0;i<255;i++){ + //analogWrite(mosfet1,i); + // analogWrite(mosfet2,50); + // delay(2000); + //} + //digitalWrite(mosfet1,HIGH); + //digitalWrite(mosfet2,HIGH); + + +pinMode(LASER, OUTPUT); +analogWrite(LASER, 100); + +pinMode(Relay1, OUTPUT); +pinMode(Relay2, OUTPUT); +pinMode(Relay3, OUTPUT); +pinMode(Relay4, OUTPUT); +pinMode(A1, OUTPUT); +digitalWrite(A1, LOW); +digitalWrite(Relay1, HIGH); +digitalWrite(Relay2, HIGH); +digitalWrite(Relay3, HIGH); +digitalWrite(Relay4, HIGH); +delay(2000); +digitalWrite(Relay1,LOW); +digitalWrite(Relay2,LOW); +digitalWrite(Relay3,LOW); +digitalWrite(Relay4,LOW); +digitalWrite(A1, HIGH); + + +pinMode (stepPin, OUTPUT); +pinMode (dirPin, OUTPUT); +pinMode (enblPin, OUTPUT); + +pinMode (stepPin1, OUTPUT); +pinMode (dirPin1, OUTPUT); +pinMode (enblPin1, OUTPUT); + +digitalWrite(stepPin, LOW); +digitalWrite(dirPin, LOW); +digitalWrite(enblPin, HIGH); + + +digitalWrite(stepPin1, LOW); +digitalWrite(dirPin1, LOW); +digitalWrite(enblPin1, HIGH); +delay(100); +digitalWrite(enblPin, LOW); +digitalWrite(enblPin1, LOW); + +} + +void loop() { +delay(2000); +digitalWrite(dirPin, HIGH); +for(int x=0; x<800; x++){ +digitalWrite(stepPin, HIGH); +delay(delayy); +digitalWrite(stepPin, LOW); +delay(delayy); +} +delay(2000); +digitalWrite(dirPin, LOW); +for(int x=0; x<800; x++){ +digitalWrite(stepPin, HIGH); +delay(delayy); +digitalWrite(stepPin, LOW); +delay(delayy); +} +delay(2000); +digitalWrite(dirPin1, HIGH); +for(int x=0; x<1300; x++){ +digitalWrite(stepPin1, HIGH); +delay(delayy); +digitalWrite(stepPin1, LOW); +delay(delayy); +} +delay(2000); +digitalWrite(dirPin1, LOW); +for(int x=0; x<1300; x++){ +digitalWrite(stepPin1, HIGH); +delay(delayy); +digitalWrite(stepPin1, LOW); +delay(delayy); +//exit(0); +} +} + |