RuiViana

Teste_595.ino

Jun 15th, 2021
606
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define DATA 11        // Pin TPIC6B595 3
  2. #define LATCH 10       // Pin TPIC6B595 12
  3. #define CLOCK 12       // Pin TPIC6B595 13
  4.  
  5. int digits[] = {
  6.    B11111100,
  7.    B01100000,
  8.    B11011010,
  9.    B11110010,
  10.    B01100110,
  11.    B10110110,
  12.    B10111110,
  13.    B11100000,
  14.    B11111110,
  15.    B11110110,
  16.    B11101110,
  17.    B00111110,
  18.    B10011100,
  19.    B01111010,
  20.    B10011110,
  21.    B10001110};
  22.  
  23. void setup() {
  24.    pinMode(DATA, OUTPUT);
  25.    pinMode(LATCH, OUTPUT);
  26.    pinMode(CLOCK, OUTPUT);
  27.    Serial.begin(9600);
  28. }
  29.  
  30. void loop() {
  31.    int i;
  32.    for (i = 0; i < 16; i++) {
  33.       Serial.println(i);
  34.       digitalWrite(LATCH, LOW);
  35.       shiftOut(DATA, CLOCK, LSBFIRST, digits[i]);
  36.       digitalWrite(LATCH, HIGH);
  37.       delay(500);
  38.    }
  39. }
RAW Paste Data