You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
697 B
33 lines
697 B
// https://www.youtube.com/watch?v=3JDgL9rgVb0&list=PLGs0VKk2DiYw-L-RibttcvK-WBZm8WLEP&index=44 |
|
|
|
#include <Arduino.h> |
|
|
|
int latchPin = 11; |
|
int clockPin = 9; |
|
int dataPin = 12; |
|
|
|
int dt = 3000; |
|
byte ledByte = 0b10000000; |
|
|
|
|
|
void setup() { |
|
// put your setup code here, to run once: |
|
Serial.begin(9600); |
|
pinMode(latchPin, OUTPUT); |
|
pinMode(clockPin, OUTPUT); |
|
pinMode(dataPin, OUTPUT); |
|
|
|
} |
|
|
|
void loop() { |
|
// 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 / 2; // Shift right |
|
// ledByte = ledByte * 2; // Shift left |
|
}
|
|
|