USBKeyboard.h occasionally hangs

I think those arcade buttons will be the problem. At the input points (D8 to D11) put a 0.1 uF cap to ground. That should throw away noise coming in.

Plus since these are simple buttons I think you certainly want the state change test. See reply #6.

Do both of those and then get back to us.