Difference between revisions of "Magnetic Switch"
Qian.zhang (talk | contribs) |
|||
| Line 1: | Line 1: | ||
| + | ==Introduction== | ||
| + | This is a magnetic switch module with Linker kit standard connection. | ||
| + | |||
[[File:Magnetic switch.jpg]] | [[File:Magnetic switch.jpg]] | ||
| + | ==Schematics== | ||
| + | *[https://s3.amazonaws.com/linksprite/LinkerKit/Magnetic+switch.pdf Schematics] | ||
| − | == | + | ==Application Ideas== |
| − | + | ||
| + | '''test''' | ||
| + | <syntaxhighlight lang="c"> | ||
| + | |||
| + | const int MagneticPin=9; | ||
| + | const int ledPin=13; | ||
| + | void setup() { | ||
| + | pinMode(MagneticPin, INPUT); | ||
| + | pinMode(ledPin,OUTPUT); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | int sensorValue = digitalRead(MagneticPin); | ||
| + | if(sensorValue==1) | ||
| + | { | ||
| + | digitalWrite(ledPin,HIGH); | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | digitalWrite(ledPin,LOW); | ||
| + | } | ||
| + | } | ||
| + | </syntaxhighlight> | ||
==How to buy== | ==How to buy== | ||
Here to buy Magnetic Switch on [http://store.linksprite.com/magnetic-switch-module-of-linker-kit-for-pcduino-arduino/ store] | Here to buy Magnetic Switch on [http://store.linksprite.com/magnetic-switch-module-of-linker-kit-for-pcduino-arduino/ store] | ||
Revision as of 04:59, 14 April 2014
Introduction
This is a magnetic switch module with Linker kit standard connection.
Schematics
Application Ideas
test <syntaxhighlight lang="c">
const int MagneticPin=9; const int ledPin=13; void setup() {
pinMode(MagneticPin, INPUT); pinMode(ledPin,OUTPUT);
}
void loop() {
int sensorValue = digitalRead(MagneticPin);
if(sensorValue==1)
{
digitalWrite(ledPin,HIGH);
}
else
{
digitalWrite(ledPin,LOW);
}
}
</syntaxhighlight>
How to buy
Here to buy Magnetic Switch on store
