|
楼主 |
发表于 2021-7-3 12:32
|
显示全部楼层
代码我写的是这样的:
int EN1_PIN = 2;
int DIR1_PIN = 6;
int STEP1_PIN = 5;
int EN2_PIN = 3;
int STEP2_PIN = 4;
int DIR2_PIN = 7;
void setup() {
pinMode( EN1_PIN, OUTPUT );
pinMode( DIR1_PIN, OUTPUT );
pinMode( STEP1_PIN, OUTPUT );
pinMode( EN2_PIN, OUTPUT );
pinMode( DIR2_PIN, OUTPUT );
pinMode( STEP2_PIN, OUTPUT );
}
void loop(){
digitalWrite(EN1_PIN,LOW);
digitalWrite(DIR1_PIN,HIGH);
digitalWrite(STEP1_PIN,HIGH);
digitalWrite(STEP1_PIN,LOW);
delayMicroseconds(500);
digitalWrite(EN2_PIN,LOW);
digitalWrite(DIR2_PIN,LOW);
digitalWrite(STEP2_PIN,HIGH);
digitalWrite(STEP2_PIN,LOW);
delayMicroseconds(70);
} |
|