You could maybe try something like this:
//includes and defines
int initialized;
void setup()
{
//force it low immediately
digitalWrite(3, LOW);
//clear the initialized flag on reset
initialized = 0;
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
}
//loop function
//virtual in
CAYENNE_IN(V0)
{
if(!initialized) //only once, may be could go in setup too
{
Cayenne.virtualWrite(V0,LOW);
initialized = 1;
//wait a second to allow force to set. May need longer.
delay(1000);
}
// sets digital out to whatever the virtual is set to
digitalWrite(3, getValue.asInt());
}
Cheers,
Craig