Skills Dev 4: Working with outputs

Made by Maria Jose Fernandez · UNLISTED (SHOWN IN POOLS)

Created: December 1st, 2022

0

Outcome

    • Set up the circuit with the specific items so we are able to send the instructions to activate the motor from particle

0

Process

Connect the jumpwires, resistors, motors, etc. 

Write the code and publish it in particle cloud.

Test the function

0

Reflection


0
int solPin = D2;

bool shouldActivate = false;

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

void loop()
{
  if( shouldActivate ){
    doSolenoid(  );
    shouldActivate = false;

  }
  delay( 100 );

}

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


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

}
Click to Expand
x
Share this Project

This project is only listed in this pool. Be considerate and think twice before sharing.


Courses

About

~