Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <WiFi.h>
- WiFiClient client;
- void setup()
- {
- Serial.begin(9600);
- WiFi.begin("SSID", "PASS");
- WiFi.setSleep(false);
- while (WiFi.status() != WL_CONNECTED) {
- // Check to see if connecting failed.
- // This is due to incorrect credentials
- if (WiFi.status() == WL_CONNECT_FAILED) {
- Serial.println("Failed to connect to WIFI. Please verify credentials: ");
- }
- delay(5000);
- }
- Serial.println("Wifi status :");
- Serial.println(WiFi.status());
- if (client.connect("192.168.1.101", 2222)) // always true
- {
- Serial.print("connected");
- client.print("Some string");
- }
- else{
- Serial.println("Error");
- }
- }
- void loop()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement