communication between multiple Arduino nano 33 IOTs.

I am new to Arduino and I have a question related to the communication between multiple Arduino nano 33 IOTs.

The plan for me is like this:
I want to use 2 nano 33 IOTs to send data wirelessly to another nano 33 IOT. The 3rd nano 33 is connected to PC and transfer data to PC via USB serial communication.

Each of the first 2 nanos will send out 4 long type numbers to the third nano. I want to ask what do you guys suggest me to do for this application. Should I use wifi or BLE. Can you also point me to certain examples?

Thanks

WiFiClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port. WiFiServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, it creates a local socket connected with the remote client socket on a free port and returns a WiFiClient object wrapping the socket. Everything you write or print to a WiFiClient is send to that one remote socket.

If one of your client boards creates a WiFiClient and connects it to IP address and port of the WiFiServer on your 'server' board, then you get there a WiFiClient from server.available() and this two WiFiClient objects are connected. What you write/print on one side you read only from the WiFiClient object on the other side.

client socket

   if (client.connect(serverIP, PORT)) {
     client.print("request\n");
     String response = client.readStringUntil('\n');
     Serial.println(response);
     client.stop();
   }

server side

   WiFiClient client = server.available();
   if (client && client.connected()) {
     String request = client.readStringUntil('\n');
     Serial.println(request);
     client.print("response\n");
     client.stop();
   }

the PC can receive the data directly with TCP communication in your favorite programing language

Juraj:
the PC can receive the data directly with TCP communication in your favorite programing language

Here you mean I can directly access the data from two nano 33 boards via TCP from my PC and I do not need a third nano 33 board?

Thanks

rickhan:
Here you mean I can directly access the data from two nano 33 boards via TCP from my PC and I do not need a third nano 33 board?

Yes, you can communicate from your Arduino Nano 33 IoT to any device with a WiFi or Ethernet (PC, MAC, smartphone, tablet, ..., Raspberry Pi) connection. There are many different ways to do it.

  • First you need to figure out which devices you would like to connect to. This will limit some options. For instance if you want PC/MAC/iPhone/iPad you could look for a browser option, because all of them have a web browser. But if you just want to use your PC you can have endless options (C++, C#, Python, Java, .... )

  • With the first choice you need to look for the software you want to use for writing the non-Arduino side.
    -- web browser software development on Arduino only
    -- Node-RED browser based editor where you wire flows with additional Javascript
    -- native development tools Visual Studio for Windows, Xcode for iOS, ...
    -- some cross platform tools like Python work on PC, MAC, Raspberry Pi ...

  • With the tool in mind you can select the protocol that you want to use to exchange the data
    -- HTTP you need to implement HTML inside your sketch
    -- MQTT a lightweight sensor protocol that needs a broker (a node that handles all traffic) but is very scalable a few nodes to hundred of nodes including cloud service providers
    -- TCP sockets are supported in many different software development environments but a little bit more complicated when you begin

Thanks for your suggestion. I am gonna try it.