Detect brightness changes

I try to test brightness changes in an Android application. Brightness is increased automatically in a given screen by the app. I tried adb commands to get brightness value and inspected the value of the slider, but none of these are working.