SHARE
TWEET

Untitled

a guest Jul 18th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Arduino.h>
  2. #include <WiFi.h>
  3.  
  4.  
  5. WiFiClient client;
  6.  
  7. void setup()
  8. {
  9.     Serial.begin(9600);
  10.     WiFi.begin("SSID", "PASS");
  11.     WiFi.setSleep(false);
  12.     while (WiFi.status() != WL_CONNECTED) {
  13.         // Check to see if connecting failed.
  14.         // This is due to incorrect credentials
  15.         if (WiFi.status() == WL_CONNECT_FAILED) {
  16.             Serial.println("Failed to connect to WIFI. Please verify credentials: ");
  17.         }
  18.         delay(5000);
  19.     }
  20.     Serial.println("Wifi status :");
  21.     Serial.println(WiFi.status());
  22.     if (client.connect("192.168.1.101", 2222)) // always true
  23.     {
  24.         Serial.print("connected");
  25.         client.print("Some string");
  26.     }
  27.     else{
  28.         Serial.println("Error");
  29.     }
  30. }
  31.  
  32. void loop()
  33. {
  34.  
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top