9
This challenge is inspired by Blink the CAPS LOCK by zeppelin.
Most webcams feature a small integrated LED light, indicating if the webcam is in use, as controlled by a hardware mechanism to prevent spying.
Your task is to blink it:
- Turn it on.
- Wait for 0.5 (±0.1) seconds.
- Turn it off again.
- Wait for 0.5 (±0.1) seconds;
- Repeat.
Please include a GIF or video of the webcam blinking, if possible. If an answer doesn't have the GIF, please add a GIF of the program running.
Rules
- If your language is missing a subsecond
sleep
command, your program may use a 1 second delay instead, at a penalty of an additional byte. (replacing.5
with1
)- If your language, for some reason, doesn't support
.5
, your penalty is 2 bytes. (replacing0.5
with1
)
- If your language, for some reason, doesn't support
- Your program must loop unless halted by the user.
- Your LED can start either on or off; whichever is more beneficial can be used.
- If your LED has a turning-off delay, then it doesn't have to be taken into account, unless if you want to provide an additional version.
- See this comment and its answer for more information.
Scoring
This is code-golf, which means the shortest answer in bytes wins.
2My laptop's webcam LED takes a while (around 0.3 seconds, it seems) to turn off after the video device stops being accessed. Does this have to be taken into account? – Doorknob – 2017-02-26T17:40:31.480
@Doorknob No, but you can provide a version that takes it into account if you'd like. – haykam – 2017-02-26T17:42:04.470
1The penalty should only be 1 byte, since you can just use
.5
– Elronnd – 2017-03-01T00:46:13.343@Elronnd I was going to add that, but I forgot. – haykam – 2017-03-01T02:10:41.633