Complex sentence: The device consisted of a mask worn over the eyes with LEDs positioned over the eyelids that flashed whenever the mask detected that the person had entered REM sleep.
Split into simpler sentences: The device consisted of a mask worn over the eyes with LEDs positioned over the eyelids. The LEDs flashed whenever the mask detected that the person had entered REM sleep.