Ubuntu 24.04 上の Arduino IDE 2.3.2 を使いました。
ボードは、 ESP32 Dev Module です。
WiFIClientBasic を開きます。
スケッチ例 -> WiFI -> WiFIClientBasic
SSID と password を修正
WiFiMulti.addAP("ssid***", "password***");
LAN内の、192.168.1.6 で http サーバーが動いているとすると、
host を 192.168.1.6
port を 80
にする。
const uint16_t port = 80;
// const char * host = "192.168.1.1"; // ip or dns
// const uint16_t port = 1337;
const char * host = "192.168.1.6"; // ip or dns
実行結果
$ cu -l /dev/ttyUSB0 -s 115200
Connected.
WiFi connected
IP address:
192.168.1.8
Connecting to 192.168.1.6
HTTP/1.1 400 Bad Request
Closing connection.
Waiting 5 seconds before restarting...
Connecting to 192.168.1.6
HTTP/1.1 400 Bad Request
Closing connection.
Waiting 5 seconds before restarting...
Connecting to 192.168.1.6
HTTP/1.1 400 Bad Request
Closing connection.
Waiting 5 seconds before restarting...
http サーバーから、Bad Request が返ってきているのを確認。