O2 浓度传感器 SEN0496 驱动

传感器采购自 DFRobot,基本上是即买即用。

Arduino 驱动代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*!
* @file getOxygenConcentration.ino
* @brief Enable the power, and the information is printed on the serial port.
* @n When using IIC device, select I2C address, set the dialing switch A0, A1 (Address_0 is [0 0]), (Address_1 is [1 0]), (Address_2 is [0 1]), (Address_3 is [1 1]).
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (https://www.dfrobot.com)
*/
#include "DFRobot_EOxygenSensor.h" // 需要额外安装DFRobot_EOxygenSensor库

/**
* iic slave Address, The default is E_OXYGEN_ADDRESS_0
* E_OXYGEN_ADDRESS_0 0x70
* E_OXYGEN_ADDRESS_1 0x71
* E_OXYGEN_ADDRESS_2 0x72
* E_OXYGEN_ADDRESS_3 0x73
*/
#define OXYGEN_I2C_ADDRESS E_OXYGEN_ADDRESS_0
DFRobot_EOxygenSensor_I2C oxygen(&Wire, OXYGEN_I2C_ADDRESS);

void setup()
{
Serial.begin(115200);
while(!Serial);
while(!oxygen.begin()){
Serial.println("NO Deivces !");
delay(1000);
} Serial.println("Device connected successfully !");
}

void loop()
{
Serial.print("oxygen concetnration is ");
Serial.print(oxygen.readOxygenConcentration());
Serial.println("% VOL");
delay(1000);
}

O2 浓度传感器 SEN0496 驱动
https://wonderhoi.com/2023/08/11/O2-浓度传感器-SEN0496-驱动/
作者
wonderhoi
发布于
2023年8月11日
许可协议