|
|
|
|
|
|
|
|
Serial.println(); |
|
|
Serial.println(); |
|
|
Serial.print("Connecting to "); |
|
|
Serial.print("Connecting to "); |
|
|
Serial.println(SSID); |
|
|
Serial.println(SSID); |
|
|
|
|
|
|
|
|
|
|
|
WiFi.mode(WIFI_STA); |
|
|
WiFi.begin(SSID, PSK); |
|
|
WiFi.begin(SSID, PSK); |
|
|
|
|
|
|
|
|
while (WiFi.status() != WL_CONNECTED) { |
|
|
while (WiFi.status() != WL_CONNECTED) { |
|
|
|
|
|
|
|
|
snprintf (msg, 50, "Alive since %ld milliseconds", millis()); |
|
|
snprintf (msg, 50, "Alive since %ld milliseconds", millis()); |
|
|
Serial.print("Publish message: "); |
|
|
Serial.print("Publish message: "); |
|
|
Serial.println(msg); |
|
|
Serial.println(msg); |
|
|
client.publish("/home/data", "Hello World"); |
|
|
|
|
|
|
|
|
client.publish("/home/data", "Hello asdf World"); |
|
|
delay(5000); |
|
|
delay(5000); |
|
|
} |
|
|
} |
|
|
|
|
|
|