0

first of all, I'm a bit confused about this problem so if you see any other solution it would be perfect.

I'm connecting an ESP32 to my network and sending the IP address obtained with WiFi.localIP() to a nordic nRF52 DK (works as an arduino here).

Then I write this IP in one of the BLE characteristics I created.

The problem is that I don't know how to send it, the problem is the format.

this is how I try to add the value to the characteristic:

if(Serial.available())
{
   Serial.println(Serial.read());
   wifiIP_Char.setValue(Serial.read());
}

Regards, Pablo

  • 1
    there is an IPAddress class in Arduino core. it is `Printable` so you can use it in Serial.print(ip). The IPAddress class has method `fromString`. so if you read the text version of the IPAddress into a string, then you can parse it with fromString – Juraj Jan 26 '22 at 10:49
  • Did you find any example? I don't manage, when I connect to the BLE the tablet reads either one of the bytes or directly FF. – Pablo Gonzalez Jan 26 '22 at 15:17
  • is your question about how to read Serial? – Juraj Jan 26 '22 at 15:24
  • The code you shared is calling `Serial.read()` twice. Each time will consume get another character from `Serial` - you won't get the same one twice. This is going to throw away every other character in the first call. Probably not what you intend. – romkey Jan 27 '22 at 00:53

0 Answers0