long zen = 0; long zenm = 0; void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); digitalWrite(4, 1); } void loop() { zen = 50; if (zen > zenm ) { zenm = zenm + 1; digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, LOW); delayMicroseconds(1); digitalWrite(3, LOW); delayMicroseconds(1); digitalWrite(3, HIGH); delayMicroseconds(1); digitalWrite(4, HIGH); } if (zen < zenm) { zenm = zenm - 1; digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, LOW); delayMicroseconds(1); digitalWrite(3, LOW); delayMicroseconds(1); digitalWrite(3, HIGH); delayMicroseconds(1); digitalWrite(4, HIGH); } }
Открыть пример: Online ArduBlock
Видеоурок: