Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 3, 2019 15:45
Show Gist options
  • Save parzibyte/6ffe695c5732b7a857c530bb844d48f3 to your computer and use it in GitHub Desktop.
Save parzibyte/6ffe695c5732b7a857c530bb844d48f3 to your computer and use it in GitHub Desktop.
/*
Escribir un número decimal a binario usando leds
@autor parzibyte
@web parzibyte.me
*/
#define PIN_CLOCK 2
#define PIN_LATCH 3
#define PIN_DATA 4
void setup() {
/*
Al final de todo, son pines de salida,
y debemos establecerlos como tal
*/
pinMode(PIN_CLOCK, OUTPUT);
pinMode(PIN_LATCH, OUTPUT);
pinMode(PIN_DATA, OUTPUT);
/*
Simplemente vamos a escribir un valor
*/
digitalWrite(PIN_LATCH, LOW); //Le decimos que vamos a escribir algo...
shiftOut(PIN_DATA, PIN_CLOCK, LSBFIRST, 20); //Lo escribimos
digitalWrite(PIN_LATCH, HIGH) ; //Y le indicamos que lo guarde
}
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment