# Sending MQTT messages by Arduino

**URL:** <https://community.hivemq.com/t/sending-mqtt-messages-by-arduino/769>\
**Category:** HiveMQ Client Library\
**Created:** [October 11, 2021, 3:48pm UTC](https://community.hivemq.com/t/sending-mqtt-messages-by-arduino/769 "2021-10-11T15:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckuehnel](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/ckuehnel/32/207_2.png) [@ckuehnel](https://community.hivemq.com/u/ckuehnel)\
**Post date:** [October 11, 2021, 3:48pm UTC](https://community.hivemq.com/t/sending-mqtt-messages-by-arduino/769/1 "2021-10-11T15:48:35Z")

</div>

I have a program sending MQTT messages to Cloud.MQTT. now I want to change it to send these messages to HiveMQ but get no connection. My access data are as follows:

// MQTT (CloudMQTT)  
const char\* BROKER = “ade64e41caa64820a8546270f1a7fdbc.s1.eu.hivemq.cloud”;  
uint16\_t BRPORT = 1883;  
const char\* BRUSER = “ckuehnel”;  
const char\* BRPWD = “Cksz0801”;  
const char\* CLIENTID = “ESPNOW”;

The connection is built by

void mqttconnect() {  
/\* Loop until reconnected \*/  
while (!client.connected()) {  
Serial.print(“MQTT connecting …”);

```
/* connect now */
if (client.connect(CLIENTID, BRUSER, BRPWD)) {
  Serial.println("connected");
} else {
  Serial.print("failed, status code =");
  Serial.print(client.state());
  Serial.println(" try again in 5 seconds");
  /* Wait 5 seconds before retrying */
  delay(5000);
}

```

}  
}

Is there anything that I do not see?

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [October 12, 2021, 6:59am UTC](https://community.hivemq.com/t/sending-mqtt-messages-by-arduino/769/2 "2021-10-12T06:59:06Z")

</div>

Hi Claus,

Thanks for your interest in exploring HiveMQ Cloud! What I can see is that the **port** should be **8883**.

Please let me know if that helped,  
Thank you

Dasha from HiveMQ

P.S.: for a quick test I suggest using our [MQTT-CLI](https://hivemq.github.io/mqtt-cli/) tool, that could be quickly installed and run from a desktop.
