#define F_CPU 80000000UL
#include
#include
#include
char n,k, m;
int main(void)
{
unsigned char SwitchState;
unsigned char C, B;
DDRD= 0b11100111;
DDRC= 0b11111111;
while(1){
SwitchState = PIND;
SwitchState = SwitchState & 0b00011000;
m=0;
C= 0b00000000;
B= 0b00000000;
PORTC=C;
if(SwitchState == 0b00011000)
{
while(1){
PORTC|= C;
for(k=8;k>m; k--)
{
B= (0b00000001<<k-1);
PORTC= C|B;
_delay_ms(20);
PORTC = 0b00000000;
if (k-1==m) {C|= B;};
if ((PIND&0b00011000)==0x00)
{
while ((PIND&0b00011000)==0x00);
continue;
}
}
m++;
}
}
}
}
#include
#include
#include
char n,k, m;
int main(void)
{
unsigned char SwitchState;
unsigned char C, B;
DDRD= 0b11100111;
DDRC= 0b11111111;
while(1){
SwitchState = PIND;
SwitchState = SwitchState & 0b00011000;
m=0;
C= 0b00000000;
B= 0b00000000;
PORTC=C;
if(SwitchState == 0b00011000)
{
while(1){
PORTC|= C;
for(k=8;k>m; k--)
{
B= (0b00000001<<k-1);
PORTC= C|B;
_delay_ms(20);
PORTC = 0b00000000;
if (k-1==m) {C|= B;};
if ((PIND&0b00011000)==0x00)
{
while ((PIND&0b00011000)==0x00);
continue;
}
}
m++;
}
}
}
}