updated java example
This commit is contained in:
5
arduino-example/.idea/misc.xml
generated
5
arduino-example/.idea/misc.xml
generated
@@ -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>
|
||||
|
||||
1
arduino-example/.pio/build/project.checksum
Normal file
1
arduino-example/.pio/build/project.checksum
Normal file
@@ -0,0 +1 @@
|
||||
ea44dd2727a245b26d975c53e424e4418034b6d2
|
||||
BIN
arduino-example/.pio/build/uno_r4_minima/.sconsign310.dblite
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/.sconsign310.dblite
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/FrameworkArduino/tinyusb/class/vendor/vendor_device.c.o
vendored
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/FrameworkArduino/tinyusb/class/vendor/vendor_device.c.o
vendored
Normal file
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/FrameworkArduino/tinyusb/class/vendor/vendor_host.c.o
vendored
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/FrameworkArduino/tinyusb/class/vendor/vendor_host.c.o
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/firmware.bin
Executable file
BIN
arduino-example/.pio/build/uno_r4_minima/firmware.bin
Executable file
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/firmware.elf
Executable file
BIN
arduino-example/.pio/build/uno_r4_minima/firmware.elf
Executable file
Binary file not shown.
4440
arduino-example/.pio/build/uno_r4_minima/firmware.map
Normal file
4440
arduino-example/.pio/build/uno_r4_minima/firmware.map
Normal file
File diff suppressed because it is too large
Load Diff
1
arduino-example/.pio/build/uno_r4_minima/idedata.json
Normal file
1
arduino-example/.pio/build/uno_r4_minima/idedata.json
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/lib9c8/libWiFiS3.a
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/lib9c8/libWiFiS3.a
Normal file
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/libFrameworkArduino.a
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/libFrameworkArduino.a
Normal file
Binary file not shown.
Binary file not shown.
BIN
arduino-example/.pio/build/uno_r4_minima/src/main.cpp.o
Normal file
BIN
arduino-example/.pio/build/uno_r4_minima/src/main.cpp.o
Normal file
Binary file not shown.
1
arduino-example/.pio/libdeps/uno_r4_minima/integrity.dat
Normal file
1
arduino-example/.pio/libdeps/uno_r4_minima/integrity.dat
Normal file
@@ -0,0 +1 @@
|
||||
WiFiS3
|
||||
@@ -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
|
||||
11
arduino-example/src/configure.h
Normal file
11
arduino-example/src/configure.h
Normal 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
|
||||
77
arduino-example/src/main.cpp
Normal file
77
arduino-example/src/main.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user