• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoUse Magnetic Switch on pcduino
Previous Next

Use Magnetic Switch on pcduino

Posted by: Alvin Jin , February 26, 2014

[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Module introduction” tab_id=”1393468147-1-27″][vc_column_text]Magnetic Switch Module is a magnetic switch, when the device is close or away from the field ,the internal mechanical parts will control circuit on-off, somewhat similar to Holzer sensor used in digital circuit .The following is a sample module diagram:

08[/vc_column_text][/vc_tab][vc_tab title=”Wiring diagram” tab_id=”1393468147-2-54″][vc_column_text]09

Power supply (VCC) is connected to 3.3v of pcduino , wire(GND) is connected to GND of pcduino. Signal output (SIG) is connected to analog signal input port (D1– D13), D1-D13 any one is ok.But it must be defined as same as the routine code, NC is not connected.

[/vc_column_text][/vc_tab][vc_tab title=”Demo code” tab_id=”1393468320883-2-7″][vc_column_text]#include <core.h>

#define Sensor_Pin 4

boolean HistoryStatus;

void setup()
{

pinMode(Sensor_Pin, INPUT);
HistoryStatus = digitalRead(Sensor_Pin);
printf(“Status:%s\n”,HistoryStatus?”TRUE”:”FALSE”);
}[/vc_column_text][/vc_tab][vc_tab title=”Running effect diagram” tab_id=”1393468351007-3-0″][vc_column_text]

[/vc_column_text][vc_gallery type=”flexslider_fade” interval=”3″ images=”3674,3675,3676″ onclick=”link_image” custom_links_target=”_self”][vc_column_text]Note:need to use the magnet N level to close the front of the sensor[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][/vc_column][/vc_row]

Tags: pcDuino

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