Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Código para piscar/intercalar os oito LEDs com Shift Register.
/**
* Manipulando dados no Shift Register 74HC595
* https://www.tecdicas.com/58/manipulando-dados-no-shift-register
*
* EXEMPLO1: PISCA LED
*
* Autora: Ana Paula Messina - anapaula@tecdicas.com
*
* https://www.tecdicas.com/
*
* 23/01/2019
*
* MIT
*/
/**
* Constantes para GPIOs do NodeMCU ESP-12E
*/
#define DATA 12 // D6
#define LATCH 13 // D7
#define CLK 15 // D8
/**
* Constantes para GPIOs do Arduino Atmega328p
*/
//#define DATA 8
//#define LATCH 9
//#define CLK 10
byte valorByte = 0x00;
void setup()
{
pinMode(CLK, OUTPUT);
pinMode(LATCH, OUTPUT);
pinMode(DATA, OUTPUT);
}
void loop()
{
// Em binário 0b11110000
valorByte = 0xF0;
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLK, LSBFIRST, valorByte);
digitalWrite(LATCH, HIGH);
delay(500);
// Em binário 0b00001111
valorByte = 0xF;
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLK, LSBFIRST, valorByte);
digitalWrite(LATCH, HIGH);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.