-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ken
committed
Feb 12, 2022
1 parent
6bb2374
commit a3fed52
Showing
5 changed files
with
91 additions
and
14 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
arduino_lib/examples/base/gpio_step_test/gpio_step_test.ino
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "Emakefun_MotorDriver.h" | ||
|
||
#define IN1 5 //A+ | ||
#define IN2 7 //A- | ||
#define IN3 4 //B+ | ||
#define IN4 2 //B- | ||
#define TIME 1000 | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
Serial.println("GPIO test!"); | ||
gpio.begin(1600); | ||
} | ||
|
||
void onesteps() | ||
{ | ||
gpio.setPin(IN1, HIGH); | ||
// gpio.setPin(IN2, LOW); | ||
// gpio.setPin(IN3, LOW); | ||
gpio.setPin(IN4, LOW); | ||
delayMicroseconds(TIME); | ||
|
||
gpio.setPin(IN1, LOW); | ||
// gpio.setPin(IN2, LOW); | ||
gpio.setPin(IN3, HIGH); | ||
// gpio.setPin(IN4, LOW); | ||
delayMicroseconds(TIME); | ||
|
||
gpio.setPin(IN3, LOW); | ||
gpio.setPin(IN2, HIGH); | ||
// gpio.setPin(IN1, LOW); | ||
// gpio.setPin(IN4, LOW); | ||
delayMicroseconds(TIME); | ||
|
||
gpio.setPin(IN2, LOW); | ||
// gpio.setPin(IN1, LOW); | ||
// gpio.setPin(IN3, LOW); | ||
gpio.setPin(IN4, HIGH); | ||
delayMicroseconds(TIME); | ||
} | ||
|
||
void StepStop() | ||
{ | ||
gpio.setPin(IN1, LOW); | ||
gpio.setPin(IN2, LOW); | ||
gpio.setPin(IN3, LOW); | ||
gpio.setPin(IN4, LOW); | ||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
for (int i = 0; i < 200; i++) { | ||
onesteps(); | ||
} | ||
StepStop(); | ||
delay(2000); | ||
} |
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 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 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