How do i send signal when in range on sensor

I have a ultrasonic sensor wired up and i want it to send a signal to another aruduino when it detects something within a certain range. This is my code

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "Netcomm 3240";                     // your network SSID (name)
char key[] = "Ninazoyope";       // your network key
int keyIndex = 0;                                // your network key Index number
int status = WL_IDLE_STATUS;                     // the Wifi radio's status

char server[] = "10.0.1.16";

WiFiClient client;

void setup() {
  
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
}
    while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WEP network, SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, keyIndex, key);
delay(10000);

void loop() {

  // check for the presence of wifi:
  if (WiFi.status() == WL_CONNECTION_LOST) {
    Serial.println("Oops conection lost");
    // don't continue:
    while (true);
     status = WiFi.begin(ssid, keyIndex, key);
  }
  else
{

}
  

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WEP network, SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, keyIndex, key);

    // wait 10 seconds for connection:
    delay(10000);
  }


  // once you are connected :
  Serial.print("You're connected to the network");
}
}

My internet drops out so i have a system in place to reconnect :slight_smile:

Sorry I do not reverse engineer hardware by reading code. Start by posting a block diagram of your setup and show all connections to hardware devices. Also explain the media you want to communicate through and what the messages are going to be like. If it is via the internet what protocol are you trying to use?

Have you figured out how to send and receive a signal? That would be the first step.

Leave the "when in range" for later.

Yes i do know how to send signals from 1 arduino to another arduino and have now figured out how to make the arduino sensor stop detecting items after a certain amount of cm. Thanks for your help!