#define BUTTON 4 #define E_Pin 10 #define D_Pin 11 #define pr digitalRead(BUTTON) uint8_t st = 16; uint8_t SPR = 200 * st; void SH() { digitalWrite(E_Pin, 1); } void SL() { digitalWrite(E_Pin, 0); } void Run1() { SH(); delayMicroseconds(156); SL(); delayMicroseconds(156); } void Run2() { SH(); delayMicroseconds(104); SL(); delayMicroseconds(104); } void setup() { Serial.begin(9600); pinMode(BUTTON, INPUT); pinMode(E_Pin, OUTPUT); pinMode(D_Pin, OUTPUT); } void loop() { if (pr) { delay(10); while (pr) { for (uint16_t t = 0 ; t < SPR ; t++) Run1(); for (uint16_t t = 0 ; t < SPR * 6 ; t++) Run2(); for (uint16_t t = 0 ; t < SPR * 1 ; t++) Run1(); } } }