Reputation: 1
I want to change the radio duty cycle. The radio always stays on and affects energy consumption. I want it to work in a way that it will stay off for 10 seconds and stay on for 10 seconds, how and where should I do this?
I want to change the radio duty cycle. The radio always stays on and affects energy consumption. I want it to work in a way that it will stay off for 10 seconds and stay on for 10 seconds, how and where should I do this
Upvotes: 0
Views: 71
Reputation: 1
Since you put Contiki-NG in your tags i assume you are working with Contiki-NG, not Contiki-OS.
First with the where: You want to do this function in your C code that is compiled into the Hardware Platform.
Then with how: You can turn on or off the radio using NETSTACK_RADIO directive. You can include the directive with the netstack.h in the Contiki OS files.
#include "net/netstack.h"
With NETSTACK_RADIO you can call this two functions, to turn on and off the radio. You can learn more about Contiki's radio configs in the Radio Documentation
NETSTACK_RADIO.on(); // Turn the radio on
NETSTACK_RADIO.off(); // Turn the radio off
You can configure a 10 second timer using the etimer_set
function. To do this I recommend using the RPL-udp example timer implementation as a starting point
Upvotes: 0