Input and Output at the same time

Hye . I want to create a project that measure current . But before the sensor measure the current, I need to turn on the fan first . After the fan turn on, the current sensor start measure . Someone help me please . Can I put function CAYENNE_OUT(3) in the function CAYENNE_IN(2) ??

you can try this.

CAYENNE_IN(2)
{
 x = getValue.asInt();
}

and in your main loop add this:

if (x == 1)
{
//do the sensor reading.....
    if (millis() - lastMillis > 10000)
    {
      lastMillis = millis();
      Cayenne.virtualWrite(Channel, value);  //publish data to cayenne
    }
}