HW for week2

 

IMG_0837

 

With the Arduino, you can control the lights. When you press the switch, the circuit is completed, and the light will be turned on. The red light and the green light will blink in turn.

I’ve tried two codes to make them blink in different ways. ┬áSo, I took two videos of them.

I don’t know why I cannot use the code snippets, so I just put one of my code here. I will put it into the code snippets, if it could work.

int led1=7;
int led2=6;
void setup()
{
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop()
{
digitalWrite(led1,HIGH);
delay(1000);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
delay(500);
digitalWrite(led2,LOW);
delay(300);
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);

}

 

Leave a Reply

Your email address will not be published. Required fields are marked *