Categories

keyestudio Multi-purpose shield V2 – flashing led example

The  keyestudio Multi-purpose shield V2 has 6 leds, in this example we will flash the LEDs

The LEDs are connected to pins D8 to D13

Code

//pin definition of LEDs
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int led6 = 8;
 
void setup ()
{
 
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT); 
  pinMode(led4,OUTPUT);
  pinMode(led5,OUTPUT);
  pinMode(led6,OUTPUT); 
  for(char i=8;i<14;i++)
  {
   digitalWrite(i,HIGH);  
  }  
}
 
 
void loop()
{
 digitalWrite(led1,LOW);
 delay(100);
 digitalWrite(led1,HIGH);
 digitalWrite(led2,LOW);
 delay(100);
 digitalWrite(led2,HIGH);
 digitalWrite(led3,LOW);
 delay(100);
 digitalWrite(led3,HIGH);
 digitalWrite(led4,LOW);
 delay(100);
 digitalWrite(led4,HIGH);
 digitalWrite(led5,LOW);
 delay(100);
 digitalWrite(led5,HIGH);
 digitalWrite(led6,LOW);
 delay(100);
 digitalWrite(led6,HIGH);
}

 

Links

 

keyestudio Multi-purpose shield V2 for arduino starter

Share

Leave a Reply