购买地址
相关信息
示例代码
/*!
* @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);
}