0% found this document useful (0 votes)
9 views1 page

Zadatak 1

Uploaded by

Roko Gaspert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Zadatak 1

Uploaded by

Roko Gaspert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#define STR A3

#define DATA A2
#define CLK A4

void setup() {
digitalWrite(CLK,LOW);
digitalWrite(DATA,LOW);
digitalWrite(STR,LOW);
pinMode(STR,OUTPUT);
pinMode(DATA,OUTPUT);
pinMode(CLK,OUTPUT);
}

byte zn[10] = {0b01111110 ,0b01001000 ,0b00111101, 0b01101101, 0b01001011,


0b01100111, 0b01110111, 0b01001100, 0b01111111,0b01101111};

void shiftOUT(byte n)
{
byte bitmask=0x80;

while(bitmask)
{

if(bitmask & n) digitalWrite(DATA,LOW);


else digitalWrite(DATA,HIGH);

digitalWrite(CLK,HIGH);
delay(1);
digitalWrite(CLK,LOW);
delay(1);
bitmask>>=1;
}

digitalWrite(STR,HIGH);
delay(1);
digitalWrite(STR,LOW);
delay(1);

void loop() {
for(int i = 0; i < 10; i++)
{
shiftOUT(zn[i]);
delay(500);
}

You might also like