Aleksandar Cvetkovic 2020/0553
Dependencies: Adafruit_GFX 19E042PIM_MB_PINS
Diff: main.cpp
- Revision:
- 8:56a91e0e557e
- Parent:
- 7:91c12b4167c0
- Child:
- 9:f0c788cc02a2
diff -r 91c12b4167c0 -r 56a91e0e557e main.cpp --- a/main.cpp Mon Dec 13 20:28:34 2021 +0000 +++ b/main.cpp Mon Dec 13 20:46:09 2021 +0000 @@ -58,35 +58,24 @@ int main() { - // Create a default network interface: wifi = WiFiInterface::get_default_instance(); if (!wifi) { printf("ERROR: No WiFiInterface found.\n"); return -1; } - // Connect to the network with the parameters specified in 'mbed_app.json': printf("Connecting to %s... \n",MBED_CONF_APP_WIFI_SSID); int ret = wifi->connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2); if(ret != 0){ printf("\nConnection error: %d\n", ret); return -1; } - // Print out the information aquired: printf("Connected to %s\n", MBED_CONF_APP_WIFI_SSID); - - // Open TCP socket using WiFi network interface: socket.open(wifi); - - // Connect to the HiveMQ broker: socket.connect(hostname,port); - - // Fill connect data with default values: MQTTPacket_connectData data = MQTTPacket_connectData_initializer; - // Change only ID and protocol version: data.MQTTVersion = 3; data.clientID.cstring = "pim-27"; - client.connect(data); client.subscribe(topic_sub, MQTT::QOS0, messageArrived);