#define serPin 3
unsigned char conbyte =0x55; //working variable
unsigned char reg; //conbyte storing register for ease
unsigned char k; //loop variable
void setup() {
DDRC |= (1<<serPin);
}
void loop() {
reg= conbyte;
for(k=0; k<8; k++)
{
if(reg & 0x01)
{PORTC |= (1<<serPin);} //setting value if value in register is 1
else
{PORTC &= ~(1<<serPin);} //resetting value if value in register is 0
reg= reg>>1; //updating LSB
delay(500); //regular delay
}
delay(2000); //concluding delay
}