Continuing the discussion from UNO R4 WiFi OTA With IDE:
Dear Forum Members and Arduino Team, I'm new to this platform and hope for some help. As I didn't want top open up a new post/topic, I hope it is ok to post my question here as it is sort of relevant to the subject above.
I have followed now above steps, read hundreds of posts, and with help of AI, I even managed to get my Arduino UNO R4 Wifi, hooked up to a power-bank, to even connect on the code to my local Wifi and print out the IP to the attached OLED display. So far so good, and whilst I was over the Moon getting this far, I am now stuck on as it seems to be the last hurdle to transfer code via Arduino IDE 2.3.6. code to the board via OTA.
I can see the board in the selection and I can see the port (Network) with IP address 192.168.1.58 in the selection.
But yet what works so well with the USB-C connection fails with the try of sending the code via WiFi to the board.
This is the last error - hurdle - Failed uploading: no upload port provided
I checked with my Firewall and I can exclude any ports to be blocked.
AI is at its end, and I hope you have perhaps an idea why it still fails to compile?!
Would there a way to specifically designate a port to the process?
Or is this just the final meassure of the Arduino developers to block OTA and have it only available via there cloud server as that works perfectly fine.
Appreciate any idea,
KR
Sebastjan`
#include <SPI.h>
#include <WiFiS3.h>
#include <ArduinoOTA.h>
#include "arduino_secrets.h"
// OLED Libraries
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
int status = WL_IDLE_STATUS;
bool isConnected = false;
// OLED parameters
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// Initialize the OLED display
// Use a different I2C address (0x3D) if needed, based on your module
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
// This part runs if the display is not found.
// We can't print, so we blink the LED indefinitely.
while (true) {
digitalWrite(LED_BUILTIN, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
delay(250);
}
}
// Initial display setup
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Connecting WiFi...");
display.display();
// Check for WiFi shield presence
if (WiFi.status() == WL_NO_SHIELD) {
while (true) {
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
// Initiate the connection attempt
WiFi.begin(ssid, pass);
// Wait for a valid IP address. The loop now has a timeout to prevent an infinite block.
int max_attempts = 30; // 30 attempts with 1-second delay = 30 seconds max wait
int attempts = 0;
while (WiFi.status() != WL_CONNECTED || WiFi.localIP() == IPAddress(0, 0, 0, 0)) {
display.print("."); // Show progress on the OLED
display.display();
delay(1000); // Wait for a second
attempts++;
if(attempts >= max_attempts){
break; // Exit the loop if it takes too long
}
}
// Check if connection was successful
if (WiFi.status() == WL_CONNECTED) {
isConnected = true;
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "Password", InternalStorage);
display.clearDisplay();
display.setCursor(0, 0);
display.println("Connected!");
display.println();
display.println("IP:");
display.println(WiFi.localIP());
display.display();
} else {
display.clearDisplay();
display.setCursor(0, 0);
display.println("Connection Failed.");
display.display();
}
}
void loop() {
if (isConnected) {
ArduinoOTA.handle();
}
}









