вот без прерываний:
void setup() {
pinMode(10, INPUT);
pinMode(11, OUTPUT);
pinMode(8, INPUT);
pinMode(9, OUTPUT);
pinMode(6, INPUT);
pinMode(7, OUTPUT);
}
void loop() {
// read the state of the pushbutton value:
// port1 = digitalRead(2);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (digitalRead(6) == LOW) {UART1;}
if (digitalRead(8) == LOW) {}
if (digitalRead(10) == LOW) {}
}
void UART1() {
uint8_t counter_delay=0;
while (counter_delay<255 ){
counter_delay=0;
uint8_t buf=255;
uint8_t counter=0;
delayMicroseconds(8);
while (counter!=8 ){delayMicroseconds(4);
if (digitalRead(6) == LOW) {bitWrite(buf, counter, 0);}
counter++;
//Buf<<=1;
}
//можно переписать принятый байт в буфер
delayMicroseconds(13);
while (digitalRead(6) == LOW and counter_delay<255){counter_delay++;}
}
}