//lightshow
int ledPin[]= {1,2,4,8,16,32,64,128,255,0,255,16,32,128,0,255};
int ledPin1[]={255,0,255,0};
void setup() {
DDRD = 0xFF; //Port D je izhod
DDRB |= 0x00;
}
void loop() {
int value = PINB & 0x01; //0b00000001
if (value==HIGH){
for (int x=0; x < (sizeof(ledPin)/sizeof(ledPin[0])); x++){
PORTD=ledPin[x];
delay(300);
}
}
if (value==LOW){
for (int x=0; x < (sizeof(ledPin)/sizeof(ledPin[1])); x++){
PORTD=ledPin1[x];
delay(300);
}
}
}