/*
 Example of how to attach and use the virtual boolean variables
 
 
  
  The circuit: 
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)
 
 Note:
 Not all pins on the Mega and Mega 2560 support change interrupts, 
 so only the following can be used for RX: 
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

*/
#include <hmi.h>

SoftwareSerial mySerial(10, 11); // RX pin, TX pin

boolean switch_A;   //Received boolean from the Hmi app
boolean led;            //Boolean variable to sent to the Hmi app. 

void setup() {
  
    Hmi.pinMode(13,OUTPUT);        //Pin 13 as an output pin.
  
    mySerial.begin(9600);
    
    Hmi.attachBooleanIn(switch_A,'A');  //Attach the variable button_pin13 as an IN boolean to the Hmi system with the name tag 'A'
    Hmi.attachBooleanOut(led,'b');          //Attach the variable led as an OUT boolean to the Hmi system with the name tag 'b'
    
  }
  
  
 void loop(){
   
   if(switch_A){
        digitalWrite(13, HIGH);
        led=false;
      }
      
      else{
        digitalWrite(13, LOW);
        led=true;
      }
  
    Hmi.softSerial(mySerial); 
  }

