How many LED blinking patterns can made with nine leds in arduino ( part 4 )

Votes : 5
1540

Before reading this article, Do not watch before or Have not any idea about LEDs blinking pattern programming. Browse Custom LED blinking pattern article ( Explain in here, How to design custom LEDs pattern, you own ).

LEDs blinking pattern with nine leds in arduino

LED blinking tenth pattern

int op[]  = {13, 12, 11, 10, 9, 8, 7, 6, 5};
int speed = 200;
int point1 = 0;
int point2 = 1;
int side = 0;
void setup() {
  for (int i = 0; i < 9; i++) { pinMode(op[i], OUTPUT); }
}
void loop() {
  for (int i = 0; i < 9; i++) {  digitalWrite(op[i], LOW); }
  for (int i = point1; i < point2; i++) {  digitalWrite(op[i], HIGH); }
  if (side == 0) {
    point2++;
    if (point2 > 8) { side = 1; }
  } else {
    point1++;
    if (point1 > 8) { side =  point1 = 0; point2 = 1;  }
  }
  delay(speed);
}

LED blinking eleventh pattern

int op[]  = {13, 12, 11, 10, 9, 8, 7, 6, 5};
int speed = 1000;
int point = 4;
int side = 0;
void setup() {
  for (int i = 0; i < 9; i++) { pinMode(op[i], OUTPUT); }
}
void loop() {
  for (int i = 0; i < 9; i++) { digitalWrite(op[i], LOW); }
  digitalWrite(op[point], HIGH);
  if (side == 0) {
    point++;
    if (point > 8) { side = 1; point = 4; }
  } else {
    point--;
    if (point < 0) { side = 0; point = 4; }
  }
  
  delay(speed);
}

LED blinking twentieth pattern

int op[]  = {13, 12, 11, 10, 9, 8, 7, 6, 5};
int point1 = 4;
int point2 = 4;
int speed = 200;
void setup() {
  for (int i = 0; i < 9; i++) {
    pinMode(op[i], OUTPUT);
  }
}
void loop() {
  for (int i = 0; i < 9; i++) {
    digitalWrite(op[i], LOW);
  }
  digitalWrite(op[point1], HIGH);
  digitalWrite(op[point2], HIGH);
  point1--;
  point2++;
  if (point1 < 0) {
    point1 = 4;
    point2 = 4;
  }
  delay(speed);
}
asked 4 months,13 days ago

What is the codrate ?

codrate.com is a standard, fast cross browsing and highly versatile site. It is useful for many large number of Program Development Industries. So you can get support form Codrators , who are the codrate's joiners around world to help your program developments, You can answer other codrator's questions. Communicate with them. Share your knowledge with them. Do you have an interest in programming, So publish your articles about programming. It will help to maintain your professional co-profile. Actually codrate.com is not such as a regular web site. It will be gave new experience, best narrow cross-browser view, reduce processing time to receive browsing request, it's mean do not wasting your time to browsing codrate's web pages because it has been upgrade always modern coding ways. So, what do you waiting for ?. Try your own.

Copyright 2015 Pride - Company. Design by Esila