
#ifndef VirtuinoUp_H
#define VirtuinoUp_H
  
  #include "VirtuinoCM.h"


class VirtuinoUp : public VirtuinoCM{
  public:   
	VirtuinoUp ();
};

#endif



//========== V_memory (32)
#define V_MEMORY(val)\
    const int V_memory_count = val;\
    float V[V_memory_count];  // int,long...[<=255]









// Fonctions dans le loop() du programme de démo
#define VIRTUINO2_FCT()   \
void onReceived(char variableType, uint8_t variableIndex, String valueAsText){\
    if (variableType=='V'){\
        float value = valueAsText.toFloat();\
        if (variableIndex<V_memory_count) V[variableIndex]=value;\
    }\
}\
\
String onRequested(char variableType, uint8_t variableIndex){\
    if (variableType=='V') {\
    if (variableIndex<V_memory_count) return  String(V[variableIndex]);\
	}return "";\
}\
\
void virtuinoRun(){\
    while (mySerial.available()) {\
        char tempChar=mySerial.read();\
        if (tempChar==CM_START_CHAR) {\
              virtuino.readBuffer=CM_START_CHAR;\
              virtuino.readBuffer+=mySerial.readStringUntil(CM_END_CHAR);\
              virtuino.readBuffer+=CM_END_CHAR;\
              if (debug) Serial.println("\nCommand= "+virtuino.readBuffer);\
              String* response= virtuino.getResponse();\
              if (debug) Serial.println("Response : "+*response);\
              mySerial.print(*response);\
              break;\
         }\
    }\
}\
\
void vDelay(int delayInMillis){long t=millis()+delayInMillis;while (millis()<t) virtuinoRun();}







