查看: 6326|回复: 0
收起左侧

Arduino 传感器: 使用FSR402压力传感器检测压力

2017-5-4 20:19:10 | 显示全部楼层 |阅读模式
[b]1、所需材料:[/b]

FSR402 薄膜压力传感器
公头杜邦线
面包板
Arduino Uno R3
10KΩ 电阻一个
Type A转B, USB 2.0线一根(打印机线), 作为Arduino Uno的电源

[b]2、接线:[/b]
bVHs4s.png bVHs3y.png bVHs3x.png bVHs3k.gif
[b]3、例程:[/b]

int fsrPin = 0;     // A0 接口
int fsrReading;
void setup(void) {
  Serial.begin(9600);
}
void loop(void) {
  fsrReading = analogRead(fsrPin);
  Serial.print("Analog reading = ");
  Serial.print(fsrReading);
  if (fsrReading < 10) {
    Serial.println(" - No pressure");
  } else if (fsrReading < 200) {
    Serial.println(" - Light touch");
  } else if (fsrReading < 500) {
    Serial.println(" - Light squeeze");
  } else if (fsrReading < 800) {
    Serial.println(" - Medium squeeze");
  } else {
    Serial.println(" - Big squeeze");
  }
  delay(1000);
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注我们,了解更多

官方微信

服务时间:10:00-16:00

13714503811

公司地址:深圳市龙岗区南湾街道东门头路8号

Copyright © 2012-2020 Powered by 树莓派论坛 2019.4  粤ICP备15075382号-1
快速回复 返回列表 返回顶部