SEN0386 not changing frequency on Arduino Uno R4 Wifi

Hey @Kitten23 , welcome to the forums!

Hopefully, the original poster can jump in here with a resolution.

My best guess would be to try and change the frequency using the following code:

DFRobot_WT61PC sensor(&FPSerial);

unsigned long lastTime = 0;  // Store the last time we printed the frequency
unsigned long count = 0;     // Store the number of times data was received in the last second

void setup()
{
  //Use Serial as debugging serial port 
  Serial.begin(115200);

  FPSerial.begin(9600);


  sensor.modifyFrequency(DFRobot_WT61PC::FREQUENCY_100HZ);
}

The important change in that is to this line:

sensor.modifyFrequency(DFRobot_WT61PC::FREQUENCY_100HZ);

The acceptable frequency values are:

  • FREQUENCY_0_1HZ
  • FREQUENCY_0_5HZ
  • FREQUENCY_1HZ
  • FREQUENCY_2HZ
  • FREQUENCY_5HZ
  • FREQUENCY_10HZ
  • FREQUENCY_20HZ
  • FREQUENCY_50HZ
  • FREQUENCY_100HZ
  • FREQUENCY_125HZ
  • FREQUENCY_200HZ

Let us know if this helps!

Hi !

Thank you for your fast answer.

Unfortunately, your code doesn’t work and the error message is the following :slight_smile:

In file included from C:\Users\Documents\Arduino\DFRobot SEN0386\sketch_fev05a\sketch_fev05a_test\sketch_fev05a_test.ino:1:0:
C:\Users\Documents\Arduino\DFRobot SEN0386\sketch_fev05a\sketch_fev05a_test\sketch_fev05a_test.ino: In function ‘void setup()’:
c:\Users\Documents\Arduino\libraries\DFRobot_WT61PC/DFRobot_WT61PC.h:36:28: error: expected unqualified-id before numeric constant
#define FREQUENCY_100HZ 0X09
^
C:\Users\Documents\Arduino\DFRobot SEN0386\sketch_fev05a\sketch_fev05a_test\sketch_fev05a_test.ino:44:42: note: in expansion of macro ‘FREQUENCY_100HZ’
sensor.modifyFrequency(DFRobot_WT61PC::FREQUENCY_100HZ);
^~~~~~~~~~~~~~~
exit status 1

Compilation error: exit status 1

This sensor will make me cry :’(

1 Like

Hey there, @Kitten23,

The FREQUENCY_100HZ is just a macro defining a text substitution as indicated by the line:

#define FREQUENCY_100HZ 0X09

When it’s crashing out on

sensor.modifyFrequency(DFRobot_WT61PC::FREQUENCY_100HZ);

It’s most likely because it’s looking for the value DFRobot_WT61PC::0x09, which is not defined as anything.

Could you instead try the above code with just:

sensor.modifyFrequency(FREQUENCY_100HZ) 

And let us know what happens.