zoukankan      html  css  js  c++  java
  • 倾斜传感器

    倾斜传感器是一种可检测较小倾斜角度的电子开关,当垂直悬挂的倾斜开关探头在受到外力作用且偏离垂直位置17°以上时,倾斜开关内部的金属球触电断开;当外力撤销后,倾斜开关恢复到垂直状态同时金属球触点也恢复到闭合状态。

    Arduino引脚

    模块引脚

    D3

    S

    5V

    VCC

    GND

    GND

     1 int led = 13;
     2 int buttonPin = 3;
     3 int val;
     4 void setup() {
     5   // put your setup code here, to run once:
     6   pinMode(led, OUTPUT);
     7   pinMode(buttonPin, INPUT);
     8 }
     9 
    10 void loop() {
    11   // put your main code here, to run repeatedly:
    12   val = digitalRead(buutonPin);
    13   if (vaa == HIGH)
    14   {
    15     digitalWrite(led, HIGH);
    16   } esle{
    17     digitalWrite(led, LOW);
    18   }
    19 }
  • 相关阅读:
    简易计算机
    作业-继承
    exception
    作业-窗口
    作业-数字
    作业8
    作业9-1
    作业9-2
    book
    成绩录入
  • 原文地址:https://www.cnblogs.com/Liqiongyu/p/4985858.html
Copyright © 2011-2022 走看看