Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getitng Connection Fail Error #5

Closed
piyushy1 opened this issue May 29, 2023 · 2 comments
Closed

Getitng Connection Fail Error #5

piyushy1 opened this issue May 29, 2023 · 2 comments

Comments

@piyushy1
Copy link

piyushy1 commented May 29, 2023

I am trying to run sketch on Arduino Nano RP2040 Connect and getting 'Connection Faild Error'.

16:33:13.395 -> Connecting to Wi-Fi...Connecting to Wi-Fi...Connecting to Wi-Fi...Connecting to Wi-Fi... 16:35:51.138 -> Connected to Wi-Fi! 16:35:51.138 -> 16:35:51.138 -> [ChatGPT] Only print a content message 16:35:51.404 -> ===ERROR=== 16:35:51.404 -> [ERR] Connection failed!

Installed version 0.1.2
Sample Arduino Code

#include <ArduinoJson.h>
#include <WiFiNINA.h>
#include <ArduinoBearSSL.h>
#include <ChatGPT.hpp>

static const char *ssid = "xxxx";
static const char *password = "xxx";

WiFiClient client;
BearSSLClient sslClient(client);
ChatGPT<BearSSLClient> chat_gpt(&sslClient, "v1", "xxxxxx");

void setup() {
  Serial.begin(115200);

  // Wait for serial port to initialize
  while (!Serial) {
    delay(10);
  }

  // Connect to Wi-Fi network
  connectWiFi();

  // Ignore SSL certificate validation
//  client.setInsecure();

  String result;
  Serial.println("[ChatGPT] Only print a content message");
  if (chat_gpt.simple_message("gpt-3.5-turbo-0301", "user", "Planning a 3-day trip to San Diego", result)) {
    Serial.println("===OK===");
    Serial.println(result);
  } else {
    Serial.println("===ERROR===");
    Serial.println(result);
  }
}

void loop() {}

void connectWiFi() {
  // Connect to Wi-Fi network
}

Any suggestions would be helpful.

@0015
Copy link
Owner

0015 commented May 29, 2023

@piyushy1 could you try it again with the insecure connection option? I believe your client has the option called, setInsecure or something similar.

@piyushy1
Copy link
Author

Thanks. I was able to resolve the client issue via - https://reference.arduino.cc/reference/en/libraries/wifinina/wifisslclient/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants