updated java example

This commit is contained in:
strawmanbobi
2025-10-20 10:38:50 +08:00
parent f732138cb4
commit fc1b777ef4
97 changed files with 4594 additions and 3 deletions

View File

@@ -5,6 +5,11 @@
<option name="linkedExternalProjectsSettings">
<PlatformioProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</PlatformioProjectSettings>
</option>
</component>

View File

@@ -0,0 +1 @@
ea44dd2727a245b26d975c53e424e4418034b6d2

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
WiFiS3

View File

@@ -10,5 +10,8 @@
[env:uno_r4_minima]
platform = renesas-ra
board = uno_r4_minima
board = uno_r4_wifi
framework = arduino
monitor_speed = 115200
lib_deps =
WiFiS3

View File

@@ -0,0 +1,11 @@
//
// Created by strawmanbobi on 10/14/25.
//
#ifndef ARDUINO_EXAMPLE_CONFIGURE_H
#define ARDUINO_EXAMPLE_CONFIGURE_H
#define SECRET_SSID "Strawmanbobi"
#define SECRET_PASS "ghostcicy"
#endif //ARDUINO_EXAMPLE_CONFIGURE_H

View File

@@ -0,0 +1,77 @@
//
// Created by strawmanbobi on 10/14/25.
//
#include <Arduino.h>
#include <WiFiS3.h> // Library for the UNO R4 WiFi connectivity
#include "configure.h" // Your secret credentials file
// --- Global Variables ---
// Read credentials from the secrets file
const char ssid[] = SECRET_SSID;
const char pass[] = SECRET_PASS;
int status = WL_IDLE_STATUS;
// --- Function to print connection details ---
void printWiFiStatus() {
// Print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// Print the UNO R4's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// Print the received signal strength (RSSI)
long rssi = WiFi.RSSI();
Serial.print("Signal Strength (RSSI): ");
Serial.print(rssi);
Serial.println(" dBm");
}
// ----------------------------------------------------------------------
void setup() {
Serial.begin(115200);
while (!Serial); // Wait for serial port to connect
Serial.println("--- Arduino UNO R4 WiFi: Station Mode ---");
// Set the board to Wi-Fi Station (client) mode
// The WiFiS3 library handles this mode implicitly with WiFi.begin()
// Attempt to connect to the Wi-Fi network
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to the Wi-Fi network
// This is a blocking call that retries until a connection is made or times out
status = WiFi.begin(ssid, pass);
if (status == WL_CONNECTED) {
// If connected successfully
Serial.println("\n✅ Connection Successful!");
printWiFiStatus();
} else {
// If connection failed
Serial.print("\n❌ Connection Failed! Status: ");
Serial.println(status);
}
}
// ----------------------------------------------------------------------
void loop() {
// Check WiFi status and attempt to reconnect if disconnected
if (WiFi.status() != WL_CONNECTED) {
Serial.print("Connection lost. Reconnecting...");
status = WiFi.begin(ssid, pass);
if (status == WL_CONNECTED) {
Serial.println("Reconnected!");
printWiFiStatus();
}
}
// Your main application logic goes here
delay(5000);
}