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 ![]()