我正在尝试建立从 Amazon Web Service IoT(物联网)到我的 Arduino Yun 的连接。我遵循了关于使用“BasicPubSub”Arduino 示例发送和接收消息的教程,但它会说:
Failed to Connect!
-13
这意味着“CONNECT_CREDENTIAL_NOT_FOUND”。我在头文件中有正确的凭据和信息,也有正确的文件,它们是:目录中的 xxx-certificate.pem.crt、xxx-private.pem.key 和 root_certificate.pem,“/root/certs /",当我 SSH 进入 Arduino Yun 时。以下是我的头文件:
#ifndef config_usr_h
#define config_usr_h
// Copy and paste your configuration into this file
//===============================================================
#define AWS_IOT_MQTT_HOST "xxx.iot.us-east-1.amazonaws.com" // endpoint
#define AWS_IOT_MQTT_PORT 8883
#define AWS_IOT_CLIENT_ID "client_id" // client ID
#define AWS_IOT_MY_THING_NAME "thing_name" // thing name
#define AWS_IOT_ROOT_CA_FILENAME "root_certificate.pem" // root-CA filename
#define AWS_IOT_CERTIFICATE_FILENAME "xxx-certificate.pem.crt" // your certificate filename
#define AWS_IOT_PRIVATE_KEY_FILENAME "xxx-private.pem.key" // private key
//===============================================================
// SDK config, DO NOT modify it
#define AWS_IOT_PATH_PREFIX "../certs/"
#define AWS_IOT_ROOT_CA_PATH AWS_IOT_PATH_PREFIX AWS_IOT_ROOT_CA_FILENAME // use this in config call
#define AWS_IOT_CERTIFICATE_PATH AWS_IOT_PATH_PREFIX AWS_IOT_CERTIFICATE_FILENAME // use this in config call
#define AWS_IOT_PRIVATE_KEY_PATH AWS_IOT_PATH_PREFIX AWS_IOT_PRIVATE_KEY_FILENAME // use this in config call
#endif
所以我的问题是 Arduino Yun 无法识别目录“/root/certs/”中的文件,其中凭证用于连接到 AWS IoT。请在这个问题上帮助我。先感谢您。