• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoHow to use Linker Relay and button to control Desk ...
Previous Next

How to use Linker Relay and button to control Desk lamp on pcDuino

Posted by: admin , October 30, 2014

[vc_row][vc_column][vc_column_text]In this post , I will demo how to use Linker Relay and button to control Desk Lamp on pcDuino.

on[/vc_column_text][vc_tour][vc_tab title=”Part List” tab_id=”1414716956-1-2″][vc_column_text]Do this experiment , we need

1 x desk temp desk temp

1 x Linker relay Linker relay1 x button 

button

 

1 x Linker Base

1 x pcDuino[/vc_column_text][/vc_tab][vc_tab title=”Assemble procedure” tab_id=”1414716956-2-87″][vc_column_text]First, we need to split the desk temp base

split

 

Then take off the two lines connect to the button of the desk lamp, and connect the two lines to Linker RelayLinker relay 2

Last, we install the Linker relay and button to the linker Base

button 2All list[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1414719021349-2-0″][vc_column_text]The work of the hardware part is done

Then we need to input the code to the Arduino IDE

int relay = 5 ;
int button = 6;

void setup()
{
  pinMode(relay,OUTPUT);
  pinMode(button,INPUT);
}

void loop()
{  
  static int LED_Status = 0;
  if(digitalRead(button))
  {
    delay(20);
    if(digitalRead(button))
    {
      LED_Status ++;
      if((LED_Status&0x01))
        digitalWrite(relay,HIGH);
      else
        digitalWrite(relay,LOW);
       delay(200);
    }
  }
}

[/vc_column_text][/vc_tab][vc_tab title=”Test result” tab_id=”1414719022349-3-3″][vc_column_text]Power for the pcDuino, and input the code to the Arduino IDE.

Then click the button, and you will see the desk lamp will change light on or off.

offon 2[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Share!
Tweet

admin

About the author

Comments are closed.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors