int ledPin[] = {1, 2, 4, 8, 16, 32, 64, 128, 0, 255, 0x0F, 0, 0xF0, 0};
void setup() {
DDRD = 0xFF; //255 ali ob11111111
}
void loop() {
for(int x = 0; x < (sizeof(ledPin) / sizeof(ledPin[0])); x++){
PORTD = ledPin[x];
delay(300);
}
}
/*
void setup() {
DDRD = 0xFF; //255 ali ob11111111
DDRB &= 0b11111110; // PB0 je vhod
//Serial.begin(115200);
changeTime = millis();
}
void loop() {
value = PINB & 0b00000001; // 0x01 => 0x01 ali 0x00
if((millis() - changeTime) > timeDelay){
if(value == 0){ // tipka je pritisnjena
if(counter > 128 | counter < 1) counter = 1;
PORTD = counter;
counter *= 2;
}
if(value == 1){ // tipka ni pritisnjena
if(counter <= 0 | counter > 128) counter = 128;
PORTD = counter;
counter /= 2;
}
changeTime = millis();
}
}
*/
/*
void setup() {
DDRD = 0xFF; //255 ali ob11111111
//Serial.begin(115200);
changeTime = millis();
}
void loop() {
PORTD = counter;
if((millis() - changeTime) > timeDelay){
if(direction == 1){
counter *= 2;
//Serial.println(counter);
}
else counter /= 2;
changeTime = millis();
if(counter > 64) direction = 0;
if (counter <= 1) direction = 1;
}
}
*/
/*
void setup() {
DDRD = 0xFF; //255 ali ob11111111
//Serial.begin(115200);
}
void loop() {
for(int x = 0; x < 8; x++){
PORTD = counter;
delay(200);
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;
}
}
*/