Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /*
  2. Escribir un número decimal a binario usando leds
  3.  
  4. @autor parzibyte
  5. @web parzibyte.me
  6. */
  7.  
  8. #define PIN_CLOCK 2
  9. #define PIN_LATCH 3
  10. #define PIN_DATA 4
  11. void setup() {
  12. /*
  13. Al final de todo, son pines de salida,
  14. y debemos establecerlos como tal
  15. */
  16. pinMode(PIN_CLOCK, OUTPUT);
  17. pinMode(PIN_LATCH, OUTPUT);
  18. pinMode(PIN_DATA, OUTPUT);
  19.  
  20. /*
  21. Simplemente vamos a escribir un valor
  22. */
  23. digitalWrite(PIN_LATCH, LOW); //Le decimos que vamos a escribir algo...
  24. shiftOut(PIN_DATA, PIN_CLOCK, LSBFIRST, 20); //Lo escribimos
  25. digitalWrite(PIN_LATCH, HIGH) ; //Y le indicamos que lo guarde
  26. }
  27. void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement