EnableInterrupt.h:1450:2: error: #error Unsupported Arduino platform
i can't compile sketch in with EnableInterrupt in Arduino IDE 2.3.2, can someone help?
EnableInterrupt.h:1450:2: error: #error Unsupported Arduino platform
i can't compile sketch in with EnableInterrupt in Arduino IDE 2.3.2, can someone help?
Welcome to the forum
Please post the sketch that you are trying to compile and details of the Arduino board that you are using and which board you have selected in the IDE
this is my sketch. I use Arduino Uno R4 wifi, and i select Arduino Uno R4 Wifi. But i think this is not about the board, because my problem is in not uploading but compiling the file. if i use Arduino ide 1.8, i can compile this sketch. but when i use 2.3.2, i cannot compile it
#include <OneWire.h>
#include <DallasTemperature.h>
#include <EnableInterrupt.h>
#define buzzer 7
const int SensorSuhu = 4;
const int SensorTur = A5;
volatile bool interruptFlag = false;
unsigned long previousMillis = 0;
const long interval = 1000;
OneWire oneWire(SensorSuhu);
DallasTemperature sensors(&oneWire);
void playTone(float frequency, long duration) {
tone(buzzer, frequency, duration);
}
void setup() {
pinMode(buzzer, OUTPUT);
pinMode(SensorTur, INPUT);
Serial.begin(9600);
sensors.begin();
enableInterrupt(SensorTur, detectChange, CHANGE);
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
unsigned long seconds = currentMillis / 1000;
unsigned long minutes = seconds / 60;
unsigned long hours = minutes / 60;
seconds = seconds % 60;
minutes = minutes % 60;
hours = hours % 24;
Serial.print("Waktu: ");
Serial.print(hours);
Serial.print(":");
Serial.print(minutes);
Serial.print(":");
Serial.println(seconds);
// Read sensor values and display them
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
int valueTur = analogRead(SensorTur);
float voltage = valueTur * (5.0 / 1023.0);
float ntu = (5.0 - voltage) * 25.0;
Serial.print("Suhu: ");
Serial.print(temperatureC);
Serial.println(" °C");
Serial.print("Kekeruhan: ");
Serial.print(ntu);
Serial.println(" NTU");
if (temperatureC > 30 && ntu > 70) {
playTone(2000, 1000); // Alarm tone
} else if (temperatureC > 30) {
playTone(500, 50); // Ringtone 1
} else if (ntu > 70) {
playTone(1000, 500); // Ringtone 2
} else {
noTone(buzzer);
}
}
if (interruptFlag) {
interruptFlag = false;
// Sensor readings already handled in the main loop
}
}
void detectChange() {
interruptFlag = true;
}
Compiling for the same board (Uno R4 WiFi)?
According to the documentation (EnableInterrupt/README.md at master · GreyGnome/EnableInterrupt · GitHub)
Emphasis added.
thx for the info. i miss the part where EnableINterrupt is not compatible for the Arduino Uno R4 Wifi. i Really Apreciate about your response. Thx
So not an IDE 2.x problem after all ![]()
I see that it is already moved it to a more suitable location on the forum.
I presume that you did not have the same board selected in each IDE when you did this
Hi @krasivy. The Arduino core provides an attachInterrupt function that appears to be equivalent to the enableInterrupt function provided by that incompatible library. So you should be able to replace the library by instead using this function in your code.
You can learn about using attachInterrupt from the documentation here:
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.