Code ID

Modified on Wed, 4 Jan, 2023 at 10:16 PM

This example shows how to identify the running program on your Arduino. Indeed, you may not remember which program was last loaded on your Arduino, or which version of your program is running.


To identify the running program, you simply need to assign a Code ID (name + version) to your Arduino code. This example illustrates how to do this.



Sketch

Upload this program : 1_Basics \ 10_CodeID


We start by declaring 2 strings to define the Code ID : a name and a version. Both strings must be placed inside the Program Memory by using the "const ... PROGMEM" keywords.


Finally, we set the Code ID by using HC_codeName() and HC_codeVersion().


#include <HITIComm.h>

// code ID
const char code_name[]    PROGMEM = "My great code";
const char code_version[] PROGMEM = "1.0.0";

void setup()
{
    // initialize library
    HC_begin();

    // set code ID
    HC_codeName(code_name);
    HC_codeVersion(code_version);
}

void loop()
{
    // communicate with HITIPanel
    HC_communicate();
}


 

Arduino Toolbar

In the Arduino Toolbar, the Code ID appears once the communication is established with your Arduino.







Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article