4Pin传感器转接板

简介

该模块是将4线的传感器(例如:SHT10\SHT20\旋转编码器)转接为gravity接口转接板。方便用户将不是我们标准接口的传感器通过此传感器转接。并且有3.3v和5V的切换。使用便利。

技术规格

引脚说明

:FIT0511.jpg

标号 名称 功能描述
1 VIN 电源输入
2 GND 电源地
3 IO1 端口1
4 IO2 端口2
5 VOUT 电源输出

表名

使用教程

以下教程示例是将温湿度传感器通过4线传感器转接板接入ArduinoUNO板,并通过串口打印数据。

准备

接线图

接线图01.jpg

样例代码

点击下载库文件[SHT1x.zip]。如何安装库? 如果教程中不涉及库的使用,请删除此提醒。


    #include <SHT1x.h>

    // Specify data and clock connections and instantiate SHT1x object
    #define dataPin  10
    #define clockPin 11
    SHT1x sht1x(dataPin, clockPin);

    void setup()
    {
       Serial.begin(38400); // Open serial connection to report values to host
       Serial.println("Starting up");
    }

    void loop()
    {
      float temp_c;
      float temp_f;
      float humidity;

      // Read values from the sensor
      temp_c = sht1x.readTemperatureC();
      temp_f = sht1x.readTemperatureF();
      humidity = sht1x.readHumidity();

      // Print the values to the serial port
      Serial.print("Temperature: ");
      Serial.print(temp_c, DEC);
      Serial.print("C / ");
      Serial.print(temp_f, DEC);
      Serial.print("F. Humidity: ");
      Serial.print(humidity);
      Serial.println("%");

      delay(2000);
    }

结果

test.jpg

常见问题

还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。 |

更多

DFshopping_car1.png DFRobot商城购买链接