If you are building a Raspberry Project with screen there may be times you need to rotate the screen. This fairly easy to do in Raspbian.
Step 1 – Edit Config.txt
Start by editing the config.txt file :
sudo nano /boot/config.txt
Add one of the following lines to the bottom of the file :
display_rotate=0 display_rotate=1 display_rotate=2 display_rotate=3
0 is the normal configuration. 1 is 90 degrees. 2 is 180 degress. 3 is 270 degrees.
If you are using the Official Raspberry Pi touch screen you can use “lcd_rotate” rather than “display_rotate”.
Save the file by using CTRL-X, Y then ENTER.
Step 2 – Reboot
Then reboot using :
sudo reboot
When the Pi restarts the display should be rotated.