ajith-kumar

unipolar-stepper-test

Jul 14th, 2021
676
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define motorPin1 D2
  2. #define motorPin2 D3
  3. #define motorPin3 D4
  4. #define motorPin4 D5
  5.  
  6. #define delayTime 20
  7.  
  8. void setup() {
  9.   pinMode(motorPin1, OUTPUT);
  10.   pinMode(motorPin2, OUTPUT);
  11.   pinMode(motorPin3, OUTPUT);
  12.   pinMode(motorPin4, OUTPUT);
  13. }
  14.  
  15. void loop() {
  16.   digitalWrite(motorPin1, HIGH);
  17.   digitalWrite(motorPin2, LOW);
  18.   digitalWrite(motorPin3, LOW);
  19.   digitalWrite(motorPin4, LOW);
  20.   delay(delayTime);
  21.   digitalWrite(motorPin1, LOW);
  22.   digitalWrite(motorPin2, HIGH);
  23.   digitalWrite(motorPin3, LOW);
  24.   digitalWrite(motorPin4, LOW);
  25.   delay(delayTime);
  26.   digitalWrite(motorPin1, LOW);
  27.   digitalWrite(motorPin2, LOW);
  28.   digitalWrite(motorPin3, HIGH);
  29.   digitalWrite(motorPin4, LOW);
  30.   delay(delayTime);
  31.   digitalWrite(motorPin1, LOW);
  32.   digitalWrite(motorPin2, LOW);
  33.   digitalWrite(motorPin3, LOW);
  34.   digitalWrite(motorPin4, HIGH);
  35.   delay(delayTime);
  36. }
  37.  
RAW Paste Data