I want to implement a function thats call "Walking-zero", this supposed to turn all 7 leds and just put one off, and must follow this pattern {1111111, 0111111, 1011111, 1101111, 1110111, 1111011, 1111101, 1111110} where each 1 represents a Led on and each 0 represents a Led off.
Im using {PB0, PB1, PB2, PB3} as my leds output.
So far ive just been able to implement a "Walking-One", which is the oposite of "Walking-Zero".
this is the code for led_config matrix and ledState()this is the code for playSequence() what that does is to keep leds on.
ive tried this:
void ledState(uint8_t j)
{
DDRB &= ~((1<<PB0) | (1<<PB1) | (1<<PB2) | (1<<PB3));
for(uint8_t i = 0; i<7; i++)
{
if( i == j)continue; //
DDRB |= (1<<led_config[i][0] | (1<<led_config[i][1]));
PORTB |= (1<<led_config[i][0]);
PORTB &= ~(1<<led_config[i][1]);
}
}
what i tried to do was that if j where equals i, that particular led wont turn on, but the rest should, at least thats what i think, honestly im stuck, any help would be appreciate.