5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



ARDUBLOCK Project 4: Button-controlled LED

Posted by Fiona Su on

Introduction:
Button is a common control electrical apparatus element,used to turn-on or turn-off circuit, as a switch of controlling motor or operating other device.
In this project, we use graphical programming to control LED turning on or off.
Materials Required:

  • 1. KEYESTUDIO UNO Control Board *1
  • 2. V5 Sensor Shield*1
  • 3. Piranha LED*1
  • 4. Button Module*1
  • 5. Female to Female Dupont Line*6

Connection Diagram:

thumb

thumb

After wiring, we can start programming.

thumb

Click “download to Arduino” to see the following codes in IDE interface:
Sample Code:

*****************************************************************************
void setup()
{
  pinMode( 4 , INPUT);
  pinMode( 10 , OUTPUT);
}

void loop()
{
  if (( digitalRead(4) && HIGH ))
  {
    digitalWrite( 10 , HIGH );
    delay( 50 );
  }
  else
  {
    digitalWrite( 10 , LOW );
    delay( 50 );
  }
}
*******************************************************************************

Result:
After finishing downloading, we can control LED by button module.

All Projects

Buy it >> ARDUBLOCK Graphical Programming Starter Kit for Arduino

0 comments

Leave a comment

Please note, comments must be approved before they are published