I wrote code in C ++ for mic attiny2313 I would like to know how this code should actually look like, because I suppose this crutch is still
The essence of the code: when you click on a button attached to port A 0b00000001, logical 1 is sequentially sent to ports B 0b00000001 - 0b00000100 when the counter reaches the limit, in this case 3, everything is reset and starts anew.
#include <avr/io.h> int main(void) { DDRB = 0xff; int count = 0; while (1) { if (PINA == 0b001) { while(1) { if (PINA == 0b000) { break; } } if (count <= 0) { count++; PORTB |= 1<<1; } else { count = 0; PORTB = 0b00000000; } } } }