|
楼主 |
发表于 2022-3-1 10:50
|
显示全部楼层
void loop(){ // Check for input if (Serial.available() > 0) { bufferInt = Serial.read(); if (bufferInt == '1') { for(int i=0; i<nbstep; i++){ digitalWrite(9, LOW); //ENABLE CH A digitalWrite(8, HIGH); //DISABLE CH B digitalWrite(12, HIGH); //Sets direction of CH A analogWrite(3, 255); //Moves CH A delay(delaylegnth); digitalWrite(9, HIGH); //DISABLE CH A digitalWrite(8, LOW); //ENABLE CH B digitalWrite(13, LOW); //Sets direction of CH B analogWrite(11, 255); //Moves CH B delay(delaylegnth); digitalWrite(9, LOW); //ENABLE CH A digitalWrite(8, HIGH); //DISABLE CH B digitalWrite(12, LOW); //Sets direction of CH A analogWrite(3, 255); //Moves CH A delay(delaylegnth); digitalWrite(9, HIGH); //DISABLE CH A digitalWrite(8, LOW); //ENABLE CH B digitalWrite(13, HIGH); //Sets direction of CH B analogWrite(11, 255); //Moves CH B delay(delaylegnth); } } } } |
|