From 45e3b5a8b3d57014e3771e9374e318fb9ff0e1e6 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 9 Jun 2009 09:27:03 +0000 Subject: [PATCH] transmit with random intervals: 2-4 seconds --- examples/rime/example-abc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/rime/example-abc.c b/examples/rime/example-abc.c index 19da07006..50a582ed8 100644 --- a/examples/rime/example-abc.c +++ b/examples/rime/example-abc.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-abc.c,v 1.5 2009/03/12 21:58:21 adamdunkels Exp $ + * $Id: example-abc.c,v 1.6 2009/06/09 09:27:03 fros4943 Exp $ */ /** @@ -40,6 +40,7 @@ #include "contiki.h" #include "net/rime.h" +#include "random.h" #include "dev/button-sensor.h" @@ -68,10 +69,11 @@ PROCESS_THREAD(example_abc_process, ev, data) abc_open(&abc, 128, &abc_call); - etimer_set(&et, 2 * CLOCK_SECOND); - while(1) { + /* Delay 2-4 seconds */ + etimer_set(&et, CLOCK_SECOND * 2 + random_rand() % (CLOCK_SECOND * 2)); + PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); packetbuf_copyfrom("Hello", 6);