• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoSensors Kit for ArduinoKY003: Hall Magnetic Field Sensor Module
Previous Next

KY003: Hall Magnetic Field Sensor Module

Posted by: admin , April 24, 2014

[vc_row][vc_column width=”1/1″][vc_column_text]KY003

 

Use the LED of digital 13, and connect the Hall magnetic field sensor to digital pin 3, and when there is magnetic shield present, the LED will turn on, otherwise, it will turn off.

 

int Led=13;

int SENSOR=3;

int val;

void setup()

{

pinMode(Led,OUTPUT);

pinMode SENSOR,INPUT);

}

void loop()

{

val=digitalRead(SENSOR);

if(val==HIGH)

{

digitalWrite(Led, HIGH);

}

Else

{

digitalWrite(Led, LOW);

}

}

[/vc_column_text][/vc_column][/vc_row]

Tags: Sensors Kit for Arduino

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors