The Mishna in Pesachim 2:5 reads as follows:
אלו דברים שאדם יוצא בהן ידי חובתו בפסח: בחיטים, בשעורים, בכוסמין ובשיפון ובשיבולת שועל
These are the things with which a person may discharge his obligation on Pesach: wheat, barley, spelt, rye and oats.
[Note that these are the commonly accepted translations of the five grains. As mentioned by Dan F in his question, some of these identifications are a matter of controversy. I will not address this in my answer.]
R. Yosef Karo (Shulchan Aruch) in Orach Chaim 453:1 quotes this Mishna more or less verbatim, and writes that all five grains may be used for the mitzva of matza at the Seder.
1. Preference for wheat matzot
(Pseudo-)Rema (to Shulchan Aruch Orach Chaim 453:1) writes that the custom is to preferably use wheat matzot.
The source of this custom traces back to Maharil, who held (Hilchot Afiyyat HaMatzot 1):
עיקר מצוה ליטול חיטין דלא מישתמיט שום תנא בלשניה כי אם חיטין לפסח
The main mitzva is to use wheat, because no Tanna ever talks about using something other than wheat for Pesach.
R. Mordechai Yaffe writes similarly (Levush HaChur 453:1):
נוהגין לקחת דוקא חיטין שהוא המובחר ומוקדם למצוה
We are accustomed to specifically use wheat, which is the choicest and first for the mitzva.
I have come across two approaches explaining this preference for wheat matzot:
Mishna Berura (453:2) explains that this custom is due to people preferring the taste of wheat matzot, and is thus a fulfillment of hiddur mitzva.
Maharsham (comments to Orchot Chaim 453:2) adds an additional reason to prefer wheat matzot; namely, that we are more experienced in ensuring that they don’t become chametz, as compared with other, less commonly used grains.
Thus, for Ashkenazim, it seems that the preference is to use wheat matzot, where possible.
2. If wheat matzot are unavailable
R. Ya'akov Reischer (Chok Ya'akov 453:2) mentions a possibility that one should follow the order of the Mishna. Thus, if wheat is unavailable, use barley, followed by spelt etc. However, he ultimately dismisses this.
R. Mordechai Yaffe (Levush HaChur 453:1) writes simply that if wheat is unavailable, one uses any of the other four grains, implying that there is no preference between them.
However, Mishna Berura (453:2) rules that if wheat matzot are unavailable, one should use whichever of the remaining four species of grain he prefers eating, so that he eats matza with appetite.