CODE: ( mataas masyado ang code di ko malagay lahat)
#define LED_1_PIN 5
#define LED_2_PIN 6
#define LED_3_PIN 7
#define LED_4_PIN 8
#define LED_5_PIN 9
#define LED_6_PIN 10
#define LED_7_PIN 11
#define BUTTON_PIN 3
void setup()
{
pinMode(LED_1_PIN, OUTPUT);
pinMode(LED_2_PIN, OUTPUT);
pinMode(LED_3_PIN, OUTPUT);
pinMode(LED_4_PIN, OUTPUT);
pinMode(LED_5_PIN, OUTPUT);
pinMode(LED_6_PIN, OUTPUT);
pinMode(LED_7_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT);
}
void loop()
{
int buttonState = digitalRead(BUTTON_PIN);
if (buttonState == HIGH) {
//1st pattern
digitalWrite(LED_1_PIN, HIGH);
delay(500);
digitalWrite(LED_2_PIN, HIGH);
delay(500);
digitalWrite(LED_3_PIN, HIGH);
delay(500);
digitalWrite(LED_4_PIN, HIGH);
delay(500);
digitalWrite(LED_5_PIN, HIGH);
delay(500);
digitalWrite(LED_6_PIN, HIGH);
delay(500);
digitalWrite(LED_7_PIN, HIGH);
delay (500);
digitalWrite(LED_1_PIN, LOW);
digitalWrite(LED_2_PIN, LOW);
digitalWrite(LED_3_PIN, LOW);
digitalWrite(LED_4_PIN, LOW);
digitalWrite(LED_5_PIN, LOW);
digitalWrite(LED_6_PIN, LOW);
digitalWrite(LED_7_PIN, LOW);
delay (100);
digitalWrite(LED_7_PIN, HIGH);
delay(500);
digitalWrite(LED_6_PIN, HIGH);
delay(500);
digitalWrite(LED_5_PIN, HIGH);
delay(500);
digitalWrite(LED_4_PIN, HIGH);
delay(500);
digitalWrite(LED_3_PIN, HIGH);
delay(500);
digitalWrite(LED_2_PIN, HIGH);
delay(500);
digitalWrite(LED_1_PIN, HIGH);
delay (500);
digitalWrite(LED_1_PIN, LOW);
digitalWrite(LED_2_PIN, LOW);
digitalWrite(LED_3_PIN, LOW);
digitalWrite(LED_4_PIN, LOW);
digitalWrite(LED_5_PIN, LOW);
digitalWrite(LED_6_PIN, LOW);
digitalWrite(LED_7_PIN, LOW);
delay (100);
digitalWrite(LED_1_PIN, HIGH);
delay(100);
digitalWrite(LED_2_PIN, HIGH);
delay(100);
digitalWrite(LED_3_PIN, HIGH);
delay(100);
digitalWrite(LED_4_PIN, HIGH);
delay(100);
digitalWrite(LED_5_PIN, HIGH);
delay(100);
digitalWrite(LED_6_PIN, HIGH);
delay(100);
digitalWrite(LED_7_PIN, HIGH);
delay (500);
digitalWrite(LED_2_PIN, LOW);
digitalWrite(LED_3_PIN, LOW);
digitalWrite(LED_4_PIN, LOW);
digitalWrite(LED_5_PIN, LOW);
digitalWrite(LED_6_PIN, LOW);
digitalWrite(LED_7_PIN, LOW);
delay (100);
Негізгі бет CONTROLLING LEDS USING ARDUINO UNO | COMPUTER APPLICATION | BSABE 2C - GROUP 5 (PRESENTATION)
No video
Пікірлер