29.11.2012 Views

t - SICS

t - SICS

t - SICS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Radio on<br />

Radio off<br />

Protothreads – Simplifying Event-driven<br />

Programming<br />

t 0<br />

t awake<br />

t wait_max<br />

t sleep<br />

Communication left…<br />

No blocking wait!<br />

1. Turn radio on.<br />

2. Wait until t = t_0 + t_awake.<br />

3. If communication has not<br />

completed, wait until it has<br />

completed or t = t_0 + t_awake +<br />

t_wait_max.<br />

4. Turn the radio off. Wait until t =<br />

t_0 + t_awake + t_sleep.<br />

5. Repeat from step 1.<br />

Problem: with events, we cannot implement this as a five-step program!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!