Back to Parent

int solPin = D3;

bool shouldActivate = false;

void setup() {
    Particle.function( "openCurtain", activateSolenoid );
    pinMode(solPin, OUTPUT);
}

void loop() {
    if( shouldActivate ){
        doSolenoid(  );
        shouldActivate = false;
    }
  delay( 100 );

}

void doSolenoid(  ){
    
    // digitalWrite(solPin, HIGH);
    
    for( int i = 0; i < 10; i++ ) {
        digitalWrite(solPin, HIGH);
        delay( 100 ) ;
        digitalWrite(solPin, LOW);
        delay( 100 );
  }
}


int activateSolenoid( String command ){
    shouldActivate = true;
    return 1;

}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0