• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoExperiment 16: relay module
Previous Next

Experiment 16: relay module

Posted by: Alvin Jin , January 8, 2014

[vc_row][vc_column width=”1/1″][vc_column_text]A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits, repeating the signal coming in from one circuit and re-transmitting it to another. Relays were used extensively in telephone exchanges and early computers to perform logical operations.

relay_cover[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”The experimental device” tab_id=”1389144196-1-58″][vc_column_text]

1* pcDuino kits

1*Relay module

1*DC Motor

1* button

Some wires

[/vc_column_text][/vc_tab][vc_tab title=”Connection diagram” tab_id=”1389144196-2-65″][vc_column_text]

IMG_4220

[/vc_column_text][/vc_tab][vc_tab title=”Code” tab_id=”1389150407187-2-5″][vc_column_text]

#include <core.h>
#define Relay 13
int val = 0;
void setup(){
pinMode(Relay, OUTPUT);
pinMode(12, INPUT);
}
void loop(){
val = digitalRead(12);
if(val==HIGH){
digitalWrite(Relay,HIGH);
}else{
digitalWrite(Relay,LOW);
}
}

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

Tags: pcDuino, pcDuino Hardware Experiments

Share!
Tweet

Alvin Jin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors