A02YYUW and measurements every 30 minutes

Dear all
I have bought an A02YYUW that I want to use for regular measurements on an ESP8266. The measured distance is to be measured every 30 minutes and transmitted to ThingSpeak. I got the sensor running on the ESP8266 via SoftwareSerial (thanks to the sample code in the wiki). I am currently using the following code:
"When "RX" floats or input High level, the module outputs processed value, the data is more steady, response time: 100-300ms; when input Low level, the module outputs real-time value, response time: 100ms."
According to this, I am probably in the "input Low Level" and therefore have real-time values. But how do I adapt the script so that one-time measurements can be made every 30 or 60 minutes?
Thank you very much for your help.
I have bought an A02YYUW that I want to use for regular measurements on an ESP8266. The measured distance is to be measured every 30 minutes and transmitted to ThingSpeak. I got the sensor running on the ESP8266 via SoftwareSerial (thanks to the sample code in the wiki). I am currently using the following code:
Code: Select all
Now I wanted to increase the delay for the measurement from 100ms, but already at 200ms the sensor does not work anymore. In the documentation I read the following:#include <SoftwareSerial.h>
SoftwareSerial mySerial(4,5); // RX, TX
unsigned char data[4]={};
float distance;
void setup()
{
Serial.begin(57600);
mySerial.begin(9600);
}
void loop()
{
do{
for(int i=0;i<4;i++)
{
data[i]=mySerial.read();
}
}while(mySerial.read()==0xff);
mySerial.flush();
if(data[0]==0xff)
{
int sum;
sum=(data[0]+data[1]+data[2])&0x00FF;
if(sum==data[3])
{
distance=(data[1]<<8)+data[2];
if(distance>30)
{
Serial.print("distance=");
Serial.print(distance/10);
Serial.println("cm");
}else
{
Serial.println("Below the lower limit");
}
}else Serial.println("ERROR");
}
delay(100);
}
"When "RX" floats or input High level, the module outputs processed value, the data is more steady, response time: 100-300ms; when input Low level, the module outputs real-time value, response time: 100ms."
According to this, I am probably in the "input Low Level" and therefore have real-time values. But how do I adapt the script so that one-time measurements can be made every 30 or 60 minutes?
Thank you very much for your help.
2021-06-21 01:23:02 Hello,
did you find a solution for this topic? I'm a newbie with all those sensor stuff and I'm currently fighting with the same issue and do not really understand how I could do this.
I would just like to somehow trigger the measure every second
Thanks in advance
fredy.erne
did you find a solution for this topic? I'm a newbie with all those sensor stuff and I'm currently fighting with the same issue and do not really understand how I could do this.
I would just like to somehow trigger the measure every second
Thanks in advance

2021-05-13 14:51:00 When I say wake-up, I mean to wake up the master with the clock module, because only the master can enter the sleep mode. You can go to the wiki of the clock module to find the specific usage method.
347945801

2021-05-12 17:52:54 Thank you for your support. But how could I realize a "wake up" or a "shut down" of the measurment-module?
dfrobot

2021-05-12 15:12:50 I think you may need a clock module to wake up the main control, and then perform measurements. It may not be successful to set the delay with the main control alone.
347945801
