Simple one pin send and receive programs and sending or receiving number 8 bug

So I made a board to read buttons and analog sticks from my game controller and send the data with those cheap 433MHz wireless boards to an Arduino board. Normally I use ATTiny261A for sending, but I modified the code to work with a ATmega328P board.

And the problem is every other sent byte value seems to work except number 8 or it’s inversion.
When it’s sending that value, the communication stops all together. The receiver is still outputting other text through serial and the sender is still outputting an ok looking signal, when observed with an oscilloscope. My oscilloscope sucks though, so I can’t be sure.

Now I could be just not using that bit, but I don’t give up on these things. And I’m very interested why it does this.

I’m sending an inversion of each byte after the byte itself for error checking and balancing the 1 and 0 counts for the wireless tx.

I have stripped much from these programs to figure out why the 00001000 or it’s inversion doesn’t work and still no luck.

  • I’m running a straight wire from sending pin to receiving pin so it’s not a wireless transmission problem.
  • It doesn’t matter if the value 8 is read from a button/pin or assigned when declaring the variable.
  • It doesn’t matter in which variable the value is sent.
  • It doesn’t matter if I’m sending only the value 8 or only the inverted byte 247 or both, any one of them freezes the communication.
  • Sending 247 and it’s inversion doesnt freeze the communication! I find this and the upper one really weird.
  • If I assing 8 and it’s inversion straight in to the receivers data array, it doesn’t cut the communication.

I must be missing something, but what is it? And is it in the send or receive program… Sorry for the lack of comments in receive program in some parts.

UnoSend.ino (7.38 KB)

UnoNanoReceive.ino (13.4 KB)

You will need to explain how your programs are supposed to work. It would take me hours to figure it out myself.