Browse Source

clean main.cpp

master
Tom Nordal 2 years ago
parent
commit
fa02507bf7
  1. 23
      ShiftRegLeds/src/main.cpp

23
ShiftRegLeds/src/main.cpp

@ -1,33 +1,10 @@
// https://www.youtube.com/watch?v=-WDO4mi2I68&list=PLGs0VKk2DiYw-L-RibttcvK-WBZm8WLEP&index=45
#include <Arduino.h> #include <Arduino.h>
int latchPin = 11;
int clockPin = 9;
int dataPin = 12;
int dt = 300;
byte ledByte = 0b10000000;
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
Serial.begin(9600); Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
} }
void loop() { void loop() {
// put your main code here, to run repeatedly: // put your main code here, to run repeatedly:
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, ledByte);
digitalWrite(latchPin, HIGH);
Serial.println(ledByte, BIN);
delay(dt);
ledByte = ledByte * 128 + ledByte / 2; // Shift right
// ledByte = ledByte / 128 + ledByte * 2; // Shift left
} }

Loading…
Cancel
Save