1 (edited by felixascher 2023-09-28 19:27:35)

Topic: RemoteXY + ESP32 + Ultrasonic - creates no network

So I'm currently working on a relatively small project for an ultrasonic reader, who prints out a message and let's an led blink on RemoteXY. The problem is, that my ESP32 isn't creating a network. I've tried all of the examples and they seem to work. I would be super thankfull if anyone knows what's wrong with the code standing below. I'm programming in ArduinoIDE by the way.


#define REMOTEXY_MODE__ESP32CORE_WIFI_POINT
#include <WiFi.h>
#include <RemoteXY.h>
#include <Ultrasonic.h>

#define REMOTEXY_WIFI_SSID "Thurner"
#define REMOTEXY_WIFI_PASSWORD "Rattenberg2709"
#define REMOTEXY_SERVER_PORT 6377

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 28 bytes
  { 255,0,0,12,0,21,0,16,27,1,70,18,9,28,46,66,26,161,0,67,
  4,10,14,43,9,162,26,11 };

struct {

    // output variables
  uint8_t led_1; // led state 0 .. 1 
  char text_1[11];  // string UTF8 end zero 
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//            END RemoteXY-Konfiguration    //
/////////////////////////////////////////////

#define TRIGGER_PIN 18
#define ECHO_PIN 5

Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);


void setup()
{
  RemoteXY_Init (); 
  Serial.begin(115200);
  RemoteXY.led_1 = 0;
  strcpy(RemoteXY.text_1, "Tür geschlossen");
}

void loop()
{
  RemoteXY_Handler();

  long distance = ultrasonic.distanceRead(CM); 

  Serial.print("Abstand: ");
  Serial.print(distance);
  Serial.println(" cm");

  if (distance < 20)
  {
    RemoteXY.led_1 = 1;
    strcpy(RemoteXY.text_1, "Tür offen");
  }
  else
  {
    RemoteXY.led_1 = 0;
    strcpy(RemoteXY.text_1, "Tür geschlossen");
  }

  delay(1000);
}

2

Re: RemoteXY + ESP32 + Ultrasonic - creates no network

Remove delay(1000);
You can read more at the link in the "Loop function" header https://remotexy.com/en/help/whatiscode/
Replace delay(1000) with RemoteXY.delay(1000);

3

Re: RemoteXY + ESP32 + Ultrasonic - creates no network

Thank you very much for your answer but the problem is still the same. Maybe it's something else that's wrong? Is there anything else I can do about it?

4

Re: RemoteXY + ESP32 + Ultrasonic - creates no network

Try removing all additional code and leaving the code only from the editor.
Perhaps the ultrasonic.distanceRead() function uses too much time and the RemoteXY input buffer manages to overflow.