Creating and uploading the Arduino Sketch

Video version

Video duration : 1'21

 

Text version

HITIPanel requires only very few coding. The following code is enough to allow HITIPanel to :

  • communicate with your Arduino
  • control and monitor all the I/O
// include HITIComm library
#include <HITIComm.h>

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

void loop()
{
    // communicate with HITIPanel
    // => to place at the beginning of the loop()
    HC_communicate(); 
}

Naming convention

All HITIComm functions and variables starts with HC_.
All HITICommSupport functions and variables starts with HCS_.

 

Let’s add some code to configure pin 3 as an input for a switch and pin 13 as an output for the on-board LED.

#include <HITIComm.h>

// pins assignment
const int pin_Switch = 3;
const int pin_LED    = LED_BUILTIN;

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

    // pins mode
    pinMode(pin_Switch,  INPUT);  // pin 3  -> INPUT
    pinMode(pin_LED,     OUTPUT); // pin 13 -> OUTPUT

    // switch on-board LED ON
    digitalWrite(pin_LED, HIGH);
}

void loop()
{
    // communicate with HITIPanel
// => to place at the beginning of the loop() HC_communicate();
}

Note

You can find the above codes in our HITIComm examples :
File\Examples\HITIComm\1_Basics\0_BareMinimum
File\Examples\HITIComm\1_Basics\1_DigitalInputOutput

 

  1. Open the Arduino IDE
  2. Create a new sketch and copy-paste the above code
  3. Save the sketch on your desktop and call it MySketch
  4. Select your board.
    1.png
  5. Select the COM port of your board.
    image025.png
  6. Finally, compile and upload the program to your Arduino.
    image026.png

 

Was this article helpful?
0 out of 0 found this helpful