Minecraft – How to make the comparator work and then stop

minecraft-commandsminecraft-java-editionminecraft-redstone

I made a redstone clock that involves a command block with /testfor and a comparator attached to it. Whenever the /testfor works, the comparator turns on, but completely.(meaning it does not turn off after that) I want it to turn on, have a small delay, then turn off. is there some way that i should change this clock, or should I be doing something different with the comparator?enter image description here

Best Answer

Once it turns on the lamp trigger this command:

/blockdata (pos of the command_block with the clear command) {SuccesCount:0}

Then do a delay with redstone repeaters that triggers a command block with this command:

/setblock x y z minecraft:unpowered_comparator

Where the x, y, and z are the coordinates of your comparator. This will reset the comparator to an off state.