Created
November 15, 2018 14:09
-
-
Save giljr/a41a1df53d1dd35a11d2a0a0afe4af7a 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
// WAVE DRIVE | |
#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() { // WAVE DRIVE - one coil at a time | |
stepper = 0B0001; // 0x01; | |
delay(waiting_time); | |
stepper = 0B0010; // 0x02; | |
delay(waiting_time); | |
stepper = 0B0100; // 0x04; | |
delay(waiting_time); | |
stepper = 0B1000; // 0x08; | |
delay(waiting_time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment