Need help with code -serial

Even simpler than dkl65's example is to use 4 different single letters (A instead of X0, B instead of X1, C instead of Y0, and D instead of Y1). Then, receive one letter, and know what pin to set to what state.

If there is some application sending the data, you could have it send binary data (40, 41, 50, 51) and still get both pieces of information in one byte.