首页 > 其他 > 详细

Arduino数字贴片磁感应传感器(收藏篇)

时间:2018-01-13 17:52:27      阅读:211      评论:0      收藏:0      [点我收藏+]

 

技术分享图片

概述

  • 基于感磁材料的磁性传感器,可以用来对磁性材料(磁铁)的探测,探测范围可达3cm左右(探测范围和磁性强弱有关),与Arduino专用传感器扩展板结合使用,可以制作与磁性材料(磁铁)相关的互动作品。

技术规格

  • 工作电压:+3.3/5V
  • 接口类型:数字
  • 输出信号:平时输出高电平,检测到磁性时输出低电平
  • 重量:5g

引脚定义

数字磁感应传感器模块管脚定义:

  • 信号输出
  • 电源(VCC)
  • 地(GND)

连接示意图

技术分享图片

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin  
int val = 0;                    // variable for reading the pin status
void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare pushbutton as input
}
void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, LOW);  // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH); // turn LED ON
  }
}

 

Arduino数字贴片磁感应传感器(收藏篇)

原文:https://www.cnblogs.com/SATinnovation/p/8279316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!