Is it wrong to be obedient to gospel principles just to receive blessings?
I wouldn’t say it is wrong, but it is not the best. Remember Elder Dallin H. Oak’s classic talk, Good, Better, Best? In it he says,
“Some things are better than good, and these are the things that should command priority attention in our lives.” Good, Better, Best
People who choose to keep the commandments do so for different reasons. Some do it out of fear of God, or to please loved ones, to fit in with the culture and that obedience is good. Some as you referred to obey because they expect to receive blessings. In my opinion, that’s better, because the expectation of blessings takes faith. Faith is better than fear. The best reason to be obedient though is the reason the Savior gave us. He said, “If ye love me, keep my commandments.” John 14:15.
What difference does it make? The main one that stands out to me is when you are being obedient in anticipation of a blessing, what happens when the blessing doesn’t (appear to) come? The Lord’s ways are not our ways. Many times in my life, I have seen his abundant blessings only through the help of hindsight. Sometimes He blesses us in ways we did not expect. I’m reminded of the Garth Brooks song, Sometimes I Thank God for Unanswered Prayers, which illustrates the idea that sometimes when the thing we are praying for is not in our best interest, the Lord may bless us by saying “No.” In that moment, we might misunderstand and feel that we had not been blessed. And what about when trials come into your life? Do you assume that your obedience was not rewarded? These are misunderstandings that could lead one to doubt their testimony and even become inactive.
Contrast that with the peace and comfort that will come from obeying the commandments out of a love of God. Love illustrates not only faith, but trust. Because we love the Lord and want to please Him with our obedience, we are more patient with His timing. We are more likely to turn to Him for comfort in adversity rather than curse Him for not giving us the blessing we think we earned. Do you see how this simple shift in thought could make a difference in not only your attitude but your relationship with Father?
So while obeying in anticipation of blessings is better than not being obedient, obedience motivated by a love of God is best.