Back to Parent

Outcome


Make an LED Blink

By following the instruction, I successfully connect a basic circuit and then wrote the code to make the led blink. Here is the circuit and code.

Show Advanced Options
Circuit 1.thumb
Show Advanced Options
Show Advanced Options

Exercise 1  

Modify the program to Blink on and off every 3 seconds. I only need to change the delay time to 3s.

Show Advanced Options
Show Advanced Options

Exercise 2

Change the program to blink on and off 5 times then stop for 3 seconds. Each blink should be 0.5s (a half second). I created a for loop to enable the led blink 5 times.

Show Advanced Options
Show Advanced Options

Exercise 3

Go back to the original program. Now add a second LED to the circuit.   I connected another led to the circuit and defined it as another ledPin to control the two leds' on/off state at the same time.

Show Advanced Options
Circut 2.thumb
Show Advanced Options
Show Advanced Options

Making a Connected LED

Through the process, I am not only able to light the leds up, but control the on/off state of leds as well. Through the operating process, I can understand how to write the code to indicate the state of led being controled.

Show Advanced Options
Show Advanced Options

Exercise 1

Modify the cloud function to blink the LED 3 times after it is called. The change to be made is adding the for loop to enable the led blink 3 times after called. 

Show Advanced Options
Show Advanced Options

Exercise 2

Instead of passing a HIGH Or LOW string pass the number of times you would like it to blink. Set the function to blink that number of times. Finally once it has completed all of the blinking it should turn the LED off. I used the toInt function to translate string command to Int, and used the for loop to enable the led blink the same time as called.

Show Advanced Options
Show Advanced Options

Exercise 3

Change the program and cloud function to allow you to control both LEDs remotely. I defined another led as ledPin and code to control the state of two leds.

Show Advanced Options
Show Advanced Options

Process 

I finished the blink the leds exercises easily because I can find that I only need to make a change of the blink time and write simple for loops. I spent more time setting up different command to call the leds' state during the connected led exercises, because I need to look up additional functions to define the variable through the command. At last, I was able to understand each step of connecting the circuit and the meaning of code, which is very helpful for me to continue learning more skills.

Reflection

I am happy to see how it worked to connect user and the device together and how can the device respond to people's command. It helped me understand the theories and viewpoints in lecture and reasings better. 

Drop files here or click to select

You can upload files of up to 20MB using this form.