1: Simple Internet Appliance

Made by youngjol

Created: November 16th, 2021

0

First program: blinking LED light

0
int ledPin1 = D2;
int ledPin2 = D3;

void setup() {
    pinMode(ledPin1, OUTPUT); // Use D2 as output pin
    digitalWrite(ledPin1, LOW);
    pinMode(ledPin2, OUTPUT); 
    digitalWrite(ledPin2, LOW);
}

void loop() {
    digitalWrite(ledPin1, HIGH);
    delay(1000);
    digitalWrite(ledPin1, LOW);
    delay(1000);
  }
Click to Expand
0
dev1 ex0
Youngjoo Lee - https://youtu.be/Y_U0YUcKygY
0

Exercise 1: Modify the program to blink on and off every 3 seconds.

0
int ledPin1 = D2;
int ledPin2 = D3;

void setup() {
    pinMode(ledPin1, OUTPUT); // Use D2 as output pin
    digitalWrite(ledPin1, LOW);
    
    pinMode(ledPin2, OUTPUT); 
    digitalWrite(ledPin2, LOW);
}

void loop() {
    digitalWrite(ledPin1, HIGH);
    delay(3000);
    digitalWrite(ledPin1, LOW);
    delay(3000);
}
Click to Expand
0
dev1 ex1
Youngjoo Lee - https://youtu.be/x0BHpdE_kNM
0

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)

0
int ledPin1 = D2;
int ledPin2 = D3;

void setup() {
    pinMode(ledPin1, OUTPUT); // Use D2 as output pin
    digitalWrite(ledPin1, LOW);
    
    pinMode(ledPin2, OUTPUT); 
    digitalWrite(ledPin2, LOW);
}

void loop() {
    for (int i = 1; i<6; i++){
        digitalWrite(ledPin1, HIGH);
        delay(500);
        digitalWrite(ledPin1, LOW);
        delay(500);
    }
    delay(3000)
}
Click to Expand
0
dev1 ex2
Youngjoo Lee - https://youtu.be/H0nZymzpgcE
0

Exercise 3: Go back to the original program. Now add a second LED to the circuit. Program the LED’s to alternate blinks i.e. when LED 1 turns on, LED 2 turns off, then when LED 2 turns on, LED 1 turns off.

0
int ledPin1 = D2;
int ledPin2 = D3;

void setup() {
    pinMode(ledPin1, OUTPUT); // Use D2 as output pin
    digitalWrite(ledPin1, LOW);
    
    pinMode(ledPin2, OUTPUT); 
    digitalWrite(ledPin2, LOW);
}

void loop() {
    digitalWrite(ledPin1, HIGH);
    digitalWrite(ledPin2, LOW);
    delay(1000);
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, HIGH);
    delay(1000);
}
Click to Expand
0
dev1 ex3
Youngjoo Lee - https://youtu.be/DVpDMfvm9PE
0

Reflection

The exercises were completed as instructed. There were no experiments or explorations required to complete these tasks as they required fairly simple modifications from the initial program.

In going forwards, I would like to work on the exercises for working with functions through Particle Cloud.

There isn’t much I would do differently for a similar type of assignment. 

0
x