Uno R4 Minima or UNO

AVR/wdt.h:41:10: fatal error: avr/io.h: No such file or directory
this happens because UNO R$ is not a AVR board so how do I fix this issue since the latest Arduino IDE will not allow wdt.h or Io.h or any non-AVR board to load wdt.h or any of the other AVR ".h" files

#include <wdt.h>
/* sensor settings: G1/4 0-1.2 MPa Hydraulic Pressure Sensor */
/* the sensor is cheap and extraordinarily good. Search for models: HK1100C */
const float Voffset = 0.52;   /* Volts, depends on the stability of the supply voltage. ideal is 0.5V */
const float Vmin = 0.5;       /* Volts */
const float Vmax = 4.5;       /* Volts */
const float Pmin = 0;         /* MPa */
const float Pmax = 1.2;       /* MPa */
const float kPV = (Pmax - Pmin) / (Vmax - Vmin);

/* arduino settings */
/* To avoid voltage variations when switch ON/OFF relays, I strongly recommend that you powering arduino board through USB port, a phone charger is very suitable. */
/* The second solution is to drive the relay block from a separate power supply. I've used the first solution! */
/* Do not forget these recommendations, they are very important, the project will not work properly if the supply voltage is not stable! */
const float SupplyVoltage = 5.0;  /* depends on the power supply and the stability of the voltage conversion on the board */
const float MaxDAC = 1024.0;

/* pump sesttings */
const float max_bar_off = 1.85;    /* max pressure (permited or posible) */
const float delta = 0.4;           /* delta pressure */
const float min_bar_on = max_bar_off - delta; /* the minimum pressure at which the pump starts. The pump will operate from "min_bar_on" to  max_bar_off" */

const int Sensor = A2;             /* Analogic A2 pin for the pressure sensor */
/* To connect the sensor to a larger distance, use twisted wires, such as in the network cables, */
/* use two pairs of twisted wires, a pair of power supply (+ 5V / GND) and a pair with signal (Data / GND) */

void setup() {
    Serial.begin(9600);
  
    pinMode(7, OUTPUT); digitalWrite(3, HIGH);  /* We use two control pins for two relays */
    pinMode(4, OUTPUT); digitalWrite(4, HIGH);  /* to isolate both phases of the pump */      
  
    pinMode(Sensor, INPUT);   /* enable INPUT mode for sensor */

   // wdt_enable(WDTO_4S);      /* enable Arduino watchdog, 4 seconds */

    Serial.print("START!");
}

  // unsigned long time_end = 0;          /* "delay for stop" variable, we do not stop the pump immediately, but wait for a few seconds */
  // unsigned long stop_delay = 5*1000;   /* 5 seconds waiting when the pressure has reached the desired value, then checking if it should be stopped  */

  void loop(){

  int sensorVal=analogRead(Sensor);
 unsigned long time_end = 0;          /* "delay for stop" variable, we do not stop the pump immediately, but wait for a few seconds */
  unsigned long stop_delay = 5*1000;   /* 5 seconds waiting when the pressure has reached the desired value, then checking if it should be stopped  */
  float voltage = (sensorVal* SupplyVoltage) / MaxDAC;

  float pressure_bar = abs(kPV *( (float)voltage - Voffset ) ) * 10 ;  /* x10 = MegaPascal to Bar; use abs() to avoid negative pressure */

  Serial.print("Sensor Value: "); Serial.print(sensorVal); Serial.print(" | ");
  Serial.print("Volts: ");        Serial.print(voltage);   Serial.print(" | ");
  Serial.print("Pressure: ");     Serial.print(pressure_bar); Serial.println(" bars ");

    if (pressure_bar >= max_bar_off) {      /* Check if the pressure remains above the limit "max_bar_off" */
        if  (time_end != 0) {               /* Check if the "delay for stop" time is activated */
            if ( time_end < millis() ) {    /*  "delay for stop" end ? then turn OFF the pump */
              digitalWrite(4, HIGH); 
              digitalWrite(3, HIGH);
              Serial.println("PUMP => OFF");  
              time_end = 0;                 /* reset "delay for stop" and start new Check  */
            }
        } else {              
            time_end = millis() + stop_delay;   /* init "delay for stop" and Check if the pressure remains above the limit "max_bar_off"  */
            Serial.println("PUMP => WAIT FOR STOP...");
        }
      
    } else if (pressure_bar <= min_bar_on) {    /* the pressure is lower than the "min_bar_on" and we start the pump */
      time_end = 0;                             /* reset "delay for stop", start de pump and start/loop new Check  */
      digitalWrite(4, LOW);
      digitalWrite(3, LOW);
      Serial.println("PUMP => ON");      
    }   
    
  delay(333);     /* A check of 3 times per second in the loop is enough for my case */

  // wdt_reset();    /* reset Arduino watchdog */
}

I think you need to update your code and libraries to support the UNO R4.

Please post your code so we can have a look.

lastest update still will not work.
IDE needs modification to allow new processor to work with wdt.h . Also tries ESP 32 and same error but UNO Rev 3 or less works just fine, because they are AVR processors

I used my R4 just yesterday, and I use esp32 all the time. Maybe if you read the pinned post re 'How to get the most from the forum'. You would have a better chance to get help. I am going to take a copy of your code and compile it.

please do I use my R4 WiFi also but not with wdt.h this is first time wrtiing ccode I wish to use it

Here is proof the sketch compiles BUT I removed wdt.h, it isn't used.

that is exactly what I stated and I want to use the R4 Wifi to finish writting code so I can send results to the webpage.
So you have proved my point

And here it is for the esp32. One change is A2 is now 35 which is GPIO35.

can not read your code did you include wdt.h or not I can complle if I do not use thre wdt.h

I have no idea what you are talking about, but maybe try the R4 not R$ (shifted 4)
I think the wdt.h is a builtin, you don't need to declare it.

My code is your code with the one change

//#include <wdt.h>

If you are going to play around with wdt, I strongly suggest you reade and understand the information related to wdt at this Link

The following code works

#include <avr/wdt.h>

and


  //delay(333); /* A check of 3 times per second in the loop is enough for my case */

  wdt_reset();    /* reset Arduino watchdog */

for AVR boards, the UNO R4 is not AVR
Here are some informative screen grabs


whereas AVR is

The UNO R3 is a different platform than the UNO R4 as seen in the following two screen grabs

I think the question is "How to use the watchdog on a R4?"

Maybe this can help to fix the code:

I get this error

WARNING: library WDT claims to run on renesas architecture(s) and may be incompatible with your current board which runs on renesas_uno architecture(s).

I corrected the $ if you had reread it so what did you prove does it work with the wdt on an UNO R4 Wifi board using 2.3.6 IDE?

Sir is the UNO board a AVR board or not if it is it will work just fine but if it is not it will now work

So as I first stated R$ boards are not going to work with non-AVR board, correct?

I am using UNO R$ WiFi 1.4.

Yes UNO R4 wIFI