Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

secuenciador de leds

  • Loading branch information...
commit 451a9464daa5d2a4c0b2c55231a245021b002e88 1 parent dc3811f
@Lessnullvoid authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 DMD_01/arduino/sequenciadorLeds/sequenciadorLeds.ino
View
29 DMD_01/arduino/sequenciadorLeds/sequenciadorLeds.ino
@@ -0,0 +1,29 @@
+int timer = 100; // The higher the number, the slower the timing.
+
+void setup() {
+ // use a for loop to initialize each pin as an output:
+ for (int thisPin = 2; thisPin < 8; thisPin++) {
+ pinMode(thisPin, OUTPUT);
+ }
+}
+
+void loop() {
+ // loop from the lowest pin to the highest:
+ for (int thisPin = 2; thisPin < 8; thisPin++) {
+ // turn the pin on:
+ digitalWrite(thisPin, HIGH);
+ delay(timer);
+ // turn the pin off:
+ digitalWrite(thisPin, LOW);
+ }
+
+ // loop from the highest pin to the lowest:
+ for (int thisPin = 7; thisPin >= 2; thisPin--) {
+ // turn the pin on:
+ digitalWrite(thisPin, HIGH);
+ delay(timer);
+ // turn the pin off:
+ digitalWrite(thisPin, LOW);
+ }
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.