transmit with random intervals: 2-4 seconds
This commit is contained in:
parent
efe1bb9cff
commit
45e3b5a8b3
1 changed files with 5 additions and 3 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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 "contiki.h"
|
||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
#include "dev/button-sensor.h"
|
#include "dev/button-sensor.h"
|
||||||
|
|
||||||
|
@ -68,10 +69,11 @@ PROCESS_THREAD(example_abc_process, ev, data)
|
||||||
|
|
||||||
abc_open(&abc, 128, &abc_call);
|
abc_open(&abc, 128, &abc_call);
|
||||||
|
|
||||||
etimer_set(&et, 2 * CLOCK_SECOND);
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
|
/* Delay 2-4 seconds */
|
||||||
|
etimer_set(&et, CLOCK_SECOND * 2 + random_rand() % (CLOCK_SECOND * 2));
|
||||||
|
|
||||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||||
|
|
||||||
packetbuf_copyfrom("Hello", 6);
|
packetbuf_copyfrom("Hello", 6);
|
||||||
|
|
Loading…
Reference in a new issue