DFrobot oxygen sensor with a fan

Hello Everyone,

I was working on a project of connecting DFrobot Oxygen sensor (SEN0322) with a DFRduino UNO R3(DFR0216) and a fan.

The fan module I am using is: Ks0168 keyestudio L9110 fan control module - Keyestudio Wiki

The purpose of the fan is to turn on when the concentration is above 23% or else print that the concentration is safe/normal. I was trying to replicate the automatization of the ventilation systems in hospitals.
The problem is that I am a newbie in Arduino and coding in general so I would like if someone can help me with the code for this type of application.
Your help is gladly welcomed!

The code used for measuring the concentration:

#include "DFRobot_OxygenSensor.h"

/**
 * i2c slave Address, The default is ADDRESS_3.
 * ADDRESS_0   0x70  i2c device address.
 * ADDRESS_1   0x71
 * ADDRESS_2   0x72
 * ADDRESS_3   0x73
 */
#define Oxygen_IICAddress ADDRESS_3
#define COLLECT_NUMBER  10             // collect number, the collection range is 1-100.
DFRobot_OxygenSensor oxygen;

void setup(void)
{
  Serial.begin(9600);
  while(!oxygen.begin(Oxygen_IICAddress)){
    Serial.println("I2c device number error !");
    delay(1000);
  }
  Serial.println("I2c connect success !");
}

void loop(void)
{
  float oxygenData = oxygen.getOxygenData(COLLECT_NUMBER);
  Serial.print(" oxygen concentration is ");
  Serial.print(oxygenData);
  Serial.println(" %vol");
  delay(1000);
}

Have you tried combining the code from the keyestudio website with the DFRobot code?

Yea, that worked, with little tweaking. Haven't seen it in the first place....
Thank you!

So, you are smarter than you think.
Glad you got it to work