unsigned int counter=1;
int direction =1;
unsigned long changeTime=0;
int timeDelay = 200;
int value=0;
/*
void setup() {
DDRD=0xFF; //255 ali 0b11111111
//Serial.begin(115200)
}
void loop() {
// put your main code here, to run repeatedly:
for(int x =0; x<8;x++){
PORTD = counter;
delay(500);
counter*=2; // counter=counter*2
//Serial.println(counter);
if(counter>128) counter=128;
}
for(int x=0; x < 8; x++){
PORTD=counter;
delay(200);
counter=counter/2;
if(counter<1) counter=1;
}
}
*/
/*
void setup() {
DDRD=0xFF; //255 ali 0b11111111
DDRB &= 0b11111110; //PB0 je vhod
//Serial.begin(115200);
changeTime=millis();
}
void loop() {
value=PINB & 0b00000001; //0x01
if((millis()-changeTime)>timeDelay){
if(value==0){
if (counter>128 || counter<1) counter=1;
counter*=2;
PORTD=counter;
}
if (value==1){
if (counter<=0) counter = 128;
PORTD=counter;
counter/=2;
}
changeTime=millis();
}
}
*/
int ledPin[]={1,2,4,8,16,32,64,128,0,255,0xF0,0,0xF0,0};
void setup() {
DDRD=0xFF; //255 ali 0b11111111
}
void loop() {
for(int x =0;x<(sizeof(ledPin)/sizeof(ledPin[0]));x++){
PORTD=ledPin[x];
delay(300);
}
}