Close

Software Example 1 - Coding 101

A project log for Blinky 101

A step-by-step guide to blinky Hexabitz modules!

HexabitzHexabitz 03/09/2018 at 20:350 Comments

This is a simple example to show you the C coding workflow. We will send a broadcast ping message to all five LED modules so that they blink their red indicator LED. The message will be repeated every 500ms.

In FrontEnd task in main.c, write the following before the infinite loop: 

#if _module == 1 

BOS.response = BOS_RESPONSE_NONE; 

#endif

And this inside the loop: 

#if _module == 1 

SendMessageToModule(BOS_BROADCAST, CODE_ping, 0); 

Delay_ms(500); 

#endif

Recompile Module 1 and load. Note that the ping message takes zero parameters. The destination module ID (first parameter for SendMessageToModule API) is replaced with BOS_BROADCAST constant to broadcast the message everywhere.

For more information, about implementing these APIs check our BOS documentation.

Discussions