Currently playing with an R4 Uno Wifi but I'm getting a really strange error.
In the Web Server for Arduino examples the example "Web server" sketch can be verified and compiled without issue.
The same .h files produce an error in my sketch though and it is really not clear why - the syntax is valid but the compiler isn't playing nice and I get this error
In file included from C:\Fan_Temp_Control\Fan_Temp_Control.ino:37:0:
C:\Fan_Temp_Control\home.h:3:4: error: invalid preprocessing directive #d
the file is identical to the one in the example - it was copied and pasted -
#ifndef HOME_H
#define HOME_H
const char HOME_PAGE[] PROGMEM = R"rawliteral(
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:,">
<title>Arduino Web Server</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
background-color: #f5f5f5;
}
.container {
max-width: 600px;
margin: 0 auto;
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
margin-bottom: 30px;
}
.nav-menu {
list-style: none;
padding: 0;
margin: 0;
}
.nav-item {
margin: 15px 0;
}
.nav-link {
display: inline-block;
padding: 15px 30px;
text-decoration: none;
background-color: #007bff;
color: white;
border-radius: 5px;
font-size: 16px;
min-width: 200px;
transition: background-color 0.3s;
}
.nav-link:hover {
background-color: #0056b3;
}
.description {
margin: 30px 0;
color: #666;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<h1>Arduino Uno R4 WiFi Web Server</h1>
<div class="description">
<p>Welcome to the Arduino web server demo!</p>
<p>Explore the features below:</p>
</div>
<ul class="nav-menu">
<li class="nav-item">
<a href="/temperature" class="nav-link">🌡️ Temperature Data</a>
</li>
<li class="nav-item">
<a href="/led" class="nav-link">💡 LED Control</a>
</li>
</ul>
<br><br><br><br>
This works with Arduino Uno R4 WiFi and <a href="https://diyables.io/products/diyables-stem-v4-iot-fully-compatible-with-arduino-uno-r4-wifi" target="_blank">DIYables STEM V4 IoT</a>
</div>
</body>
</html>
)rawliteral";
#endif
In the webserver ino this compiles with no issues - in my sketch it does not
This is the declaration in my sketch - again identical to the example - and yet my sketch flat out will not compile. I am trying to add web access to an existing sketch
#include <WiFiS3.h>
#include <UnoR4WiFi_WebServer.h>
#include "home.h"
#include "temperature.h"
#include "led.h"
Is there some compiler directive I'm missing in the IDE ? - can't find one if there is #ifndef is perfectly valid so why would the compiler accept it in one sketch but blow it out in another.