How do I program my Arduino to know when it is…

How do I program my Arduino to know when it is facing the right way?:

#arduino