Skip to content

nguyen-v/Automatic-screen-rotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accelerometer based automatic screen rotation for Windows

A Python and C++ utility for automatic screen rotation.

Features

  • Automatic port detection and automatic (re)connection to the Arduino board
  • Screen orientation and position customizable for each of the 5 physical orientations (portrait, portrait flipped, landscape, landscape flipped and flat) using a configuration file
  • Control over rotation threshold and sample rates

Requirements:

Python 3.x (or use executable)

Packages:

- PySerial
- win32api

If access is denied, try: python -m pip install instead of: pip install

If you get unresolved imports, see: https://stackoverflow.com/q/53939751

VSCode with PlatformIO IDE

Libraries

- Arduino_LSM6DS3
- Adafruit_SleepyDog
Board Sensor
Arduino Nano 33 IoT LSM6DS3 Accelerometer and Gyroscope (included in the board)

Setup process

  1. Unzip the source folder

Python

  1. Install Python
    • Install listed modules
  2. Create a startup task in task scheduler https://www.jcchouinard.com/python-automation-using-task-scheduler/ Use pythonw.exe for creating a background process (start at logon), usually located at e.g. C:\Python39\pythonw.exe

Alternatively, if you don't have Python installed, use the .exe file

Arduino and PlatformIO

  1. Install VSCode and PlatformIO
    • Install listed libraries
  2. Plug in the board (USB) and upload (arrow at bottom left)

Configuration file and debugging

  1. Change the settings in rotate_screen_config.ini
    • You can execute the python script in a console for debugging purposes with py .\rotate_screen.py (open the terminal in the Source folder) or open rotate_screen_console.exe

About

Accelerometer based automatic rotation for Windows 10.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published