Skills Dev IV: Working with Outputs - Motors and Movement

Made by Tyler Howe · UNLISTED (SHOWN IN POOLS)

Turn fan on when I like a youtube video

Created: December 20th, 2022

0

Outcome

The outcome of this lab was a successful circuit consisting of a Particle Argon, a transistor, a diode, a resistor, and a fan. The functionality is that using IFTTT, when I like a YouTube video it creates a webhook that sends data to particle that causes the fan to run. 

Demonstration: https://youtube.com/shorts/Cb4jzzZzSNc 

Process

I assembled the circuit using examples from the lab website. I chose the fan instead of a solenoid from the example. I thought that the hardest part of this lab was configuring the power source for the fan as well as setting up IFTTT properly. Figuring out which direction the webhook needed to flow and where to put the right identification codes for the trigger was something that took close attention to get right. 

Reflection

I thought this was a really fun lab. Once I got a bit of sense of how IFTTT and webhooks work, I am excited by the endless possibilities! I look forward to testing out webhooks that bring data into particle but also ones that send data out from particle to trigger something else in my environment. 

0
int fanPin = D2;

bool shouldActivate = false;

void setup()
{
  Particle.function( "activate", activateFan );
  pinMode(fanPin, OUTPUT);
}

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

  }
  delay( 100 );

}

void doFan(  ){
  for( int i = 0; i < 5; i++ )
  {
    digitalWrite(fanPin, HIGH);
    delay( 1000 ) ;
    digitalWrite(fanPin, LOW);
    delay( 1000 );
  }
}


int activateFan( 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

Turn fan on when I like a youtube video