Skills Dev 1: Simple Internet Appliance

Made by Wendy Rodriguez

Blink an LED light.

Created: December 16th, 2022

0

Intention

Write about the big ideas behind your project? What are the goals? Why did you make it? What are your motivations?

The purpose and goal of this lab were to familiarize ourselves with the Particle Platform and Argon components(LEDs, resistors, cables) and make an LED light up with the help of cloud functions. This first lab was fundamental because it allowed me to ease my way into circuits and IoT comfortably. The lab's content was easy enough not to frustrate me, but I was challenged with the cloud functions since I had never used them before. 

Exercise 1 video here: https://youtu.be/TmEmgUKkUAs

Exercise 2 video here: https://youtu.be/Y9cKh-fJp8g

Exercise 3 video here: https://youtu.be/3jom0cWIoTs

0

Process

Describe the process you underwent to reach the outcome (problems encountered, how you resolved them, as well as, experiments, hacks, tests, refinments, iterations, failures)

The primary failure I experienced with this lab was the circuit. If a pin is out of line, your LED will not light up and that can be frustrating. 

0

Reflection

Reflect on the process of making this project. What did you learn? What would you do differently?

I learned how to create multiple cloud functions to control my Argon remotely while understanding the basics of electronics/circuits and coding. One thing I would do differently is trying to find a way to control multiple LEDs simultaneously. 

0
//Exercise 1
int ledPin = D3; 

void setup() 
{
    pinMode(ledPin, OUTPUT); 
    
    digitalWrite(ledPin, LOW); 
    
    //Register our Particle function here
    Particle.function("led", ledControl);
}    
    

void loop() 
{
    
  
}

//Exercise 1. Modify the cloud function to blink the LED 3 times after it is called
int ledControl(String command)
{
   int state = LOW;

   // find out the state of the led
   if(command == "HIGH")
   {
       for(int i = 0; i < 3; i++)
       {
            digitalWrite(ledPin, HIGH); 
            delay(500);               
            digitalWrite(ledPin, LOW);   
            delay(500);
       }
	   state = HIGH;
   }else if(command == "LOW")
   { 
	   state = LOW;
   }else{
	   return -1;
   }

   // write to the appropriate pin
   digitalWrite(ledPin, state);
   return 1;
}
Click to Expand
0
//Exercise 2
int ledPin = D3; 

void setup() 
{
    pinMode(ledPin, OUTPUT); 
    
    digitalWrite(ledPin, LOW); 
    
    //Register our Particle function here
    Particle.function("Controlling number of blinks", ledControl4);
}    
    

void loop() 
{
    
  
}

//Exercise 2. Controlling the number of times the LED blinks. 
int ledControl4(String command)
{
   int led = command.toInt();
   
   if(led > 0)
   {
       for(int i = 0; i <led; i++)
       {
           digitalWrite(ledPin, HIGH); 
            delay(300);        
            digitalWrite(ledPin, LOW);   
            delay(300);
       }
   }
else
   {
	   return -1;
   }
   return 1;
}
Click to Expand
0
//Exercise 3
int ledPin3 = D3; 
int ledPin2 = D2; 

void setup() 
{
    pinMode(ledPin3, OUTPUT); 
    pinMode(ledPin2, OUTPUT); 
    
    digitalWrite(ledPin3, LOW); 
    digitalWrite(ledPin2, LOW); 
    
    //Register our Particle function here
    Particle.function("RED BLINKS", ledControl3);
    Particle.function("YELLOW BLINKS", ledControl2);
}    
    

void loop() 
{
    
  
}

int ledControl3(String command)
{
   int led3 = command.toInt();
   
   if(led3 > 0)
   {
       for(int i = 0; i <led3; i++)
       {
           digitalWrite(ledPin3, HIGH); 
            delay(300);        
            digitalWrite(ledPin3, LOW);   
            delay(300);
       }
   }
else
   {
	   return -1;
   }
   return 1;
}

int ledControl2(String command)
{
   int led2 = command.toInt();
   
   if(led2 > 0)
   {
       for(int i = 0; i <led2; i++)
       {
           digitalWrite(ledPin2, HIGH); 
            delay(300);        
            digitalWrite(ledPin2, LOW);   
            delay(300);
       }
   }
else
   {
	   return -1;
   }
   return 1;
}
Click to Expand
x