Created
November 15, 2018 15:02
-
-
Save giljr/1799136683b19c9d302a14fdf82d9476 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// HALF STEP | |
#define stepper PORTB | |
#define waiting_time 500 | |
void setup() { | |
for (int z = 8; z < 12; z++) { | |
pinMode(z, OUTPUT); // pins 8,9,10,11 output for driving the motor | |
} | |
} | |
void loop() { // Half Step Drive | |
stepper = 0B0001; // 0x01; | |
delay(waiting_time); | |
stepper = 0B0011; // 0x03; | |
delay(waiting_time); | |
stepper = 0B0010; // 0x02; | |
delay(waiting_time); | |
stepper = 0B0110; // 0x06; | |
delay(waiting_time); | |
stepper = 0B0100; // 0x04; | |
delay(waiting_time); | |
stepper = 0B1100; // 0x0C; | |
delay(500); | |
stepper = 0B0001; // 0x01; | |
delay(waiting_time); | |
stepper = 0B1001; // 0x09; | |
delay(waiting_time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment