implemented led trigger logic