-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write example for working with shift register
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "../lib/Mega2560.h" | ||
#include <util/delay.h> | ||
|
||
const uint8_t dataPin = 2; | ||
const uint8_t latchPin = 3; | ||
const uint8_t clockPin = 4; | ||
|
||
void setup() { | ||
USART_Init(MYUBRR); | ||
print("Started"); | ||
|
||
pinMode(dataPin, OUTPUT); | ||
pinMode(latchPin, OUTPUT); | ||
pinMode(clockPin, OUTPUT); | ||
} | ||
|
||
int main(void) { | ||
setup(); | ||
while (1) { | ||
turn(latchPin, OFF); | ||
shiftOut(dataPin, clockPin, 0b01111111); | ||
turn(latchPin, ON); | ||
_delay_ms(1000); | ||
} | ||
return 1; | ||
} |