[Solved] #include <Avr/interrupt.h> missing in Create

Hello.
When I compile in Create, I get this error #include <Avr/interrupt.h> no such file or directory

What to do?

Which board ? What browser ? Do you have anything connected to the board ? Are you using any custom libs ?

Your folder name is wrong. It should be:

#include <avr/interrupt.h>

The previous path will work a case insensitive OS such as windows but the OS running the Create editor is case sensitive so you have to get it right.

Thank you very much! That fixed it!

I’m still getting the same error trying to include a custom library into Create – Does anyone have any ideas? I’d really like to start using Create, if possible.

/tmp/450247199/custom/RedBot/RedBot.cpp:15:27: fatal error: avr/interrupt.h: No such file or directory

#include <avr/interrupt.h>
^

compilation terminated.

exit status 1

Can you share your sketch and a link to your lib source just in case its different to anything else.

Also the board you are trying to use ?

#include <NewSoftSerial.h>
//#include <SoftwareSerial.h> // including the library for the software serial
#define DEBUG true
NewSoftSerial esp8266(10,11); /* This will make the pin 10 of arduino as RX pin and
pin 11 of arduino as the TX pin Which means that you have to connect the TX from the esp8266
to the pin 10 of arduino and the Rx from the esp to the pin 11 of the arduino*/

const int trigPin = 8; // Making the arduino’s pin 8 as the trig pin of ultrasonic sensor
const int echoPin = 9; // Making the arduino’s pin 9 as the echo pin of the ultrasonic sensor
// defining two variable for measuring the distance
long duration;
int distance;
void setup()
{
Serial.begin(9600); // Setting the baudrate at 9600
esp8266.begin(9600); // Set the baudrate according to you esp’s baudrate. your esp’s baudrate might be different from mine
pinMode(trigPin, OUTPUT); // Setting the trigPin as Output pin
pinMode(echoPin, INPUT); // Setting the echoPin as Input pin

sendData(“AT+RST\r\n”,2000,DEBUG); // command to reset the module
sendData(“AT+CWMODE=2\r\n”,1000,DEBUG); // This will configure the mode as access point
sendData(“AT+CIFSR\r\n”,1000,DEBUG); // This command will get the ip address
sendData(“AT+CIPMUX=1\r\n”,1000,DEBUG); // This will configure the esp for multiple connections
sendData(“AT+CIPSERVER=1,80\r\n”,1000,DEBUG); // This command will turn on the server on port 80
}
void loop()
{
digitalWrite(trigPin, LOW); // Making the trigpin as low
delayMicroseconds(2); // delay of 2us
digitalWrite(trigPin, HIGH); // making the trigpin high for 10us to send the signal
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH); // reading the echopin which will tell us that how much time the signal takes to come back
distance= duration*0.034/2; // Calculating the distance and storing in the distance variable

if(esp8266.available()) // This command will that check if the esp is sending a message
{
if(esp8266.find("+IPD,"))
{
delay(1000);
int connectionId = esp8266.read()-48; /* We are subtracting 48 from the output because the read() function returns
the ASCII decimal value and the first decimal number which is 0 starts at 48*/
String webpage = “

IOT Garbage Monitoring System

”;
webpage += “

”;
if (distance<5)
{
webpage+= " Trash can is Full";
}
else{
webpage+= " Trash can is Empty";
}
webpage += “

”;
String cipSend = “AT+CIPSEND=”;
cipSend += connectionId;
cipSend += “,”;
cipSend +=webpage.length();
cipSend +="\r\n";
sendData(cipSend,1000,DEBUG);
sendData(webpage,1000,DEBUG);
String closeCommand = “AT+CIPCLOSE=”;
closeCommand+=connectionId;
closeCommand+="\r\n";
sendData(closeCommand,3000,DEBUG);
}
}
}

String sendData(String command, const int timeout, boolean debug)
{
String response = “”;
esp8266.print(command);
long int time = millis();
while( (time+timeout) > millis())
{
while(esp8266.available())
{
char c = esp8266.read();
response+=c;
}
}
if(debug)
{
Serial.print(response);
}
return response;
}

this is my sketch, i have some problem, from the IDE it says that exist fatal error : avr/interrupt.h: no such file directory…
really need help, thanks

@ muhammadegaa

Please read this post first then reformat your post to use code tags.

Is your issue in the ONLINE editor or the desktop editor ?

Hi guys! I try to use a modify version of the interrupt example code gonium.net » Blog Archive » Handling external Interrupts with Arduino

I got the same error message as mention up here…

Arduino : 1.8.5 (Windows 10), Carte : “Arduino Nano, ATmega328P”

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Franck\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -ide-version=10805 -build-path C:\Users\Franck\AppData\Local\Temp\arduino_build_221932 -warnings=none -build-cache C:\Users\Franck\AppData\Local\Temp\arduino_cache_5299 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Franck\Dropbox\Mes documents_PROFESSIONNEL_Entreprises_Raspberry Scientific_Équipe Dévelopement Raspberry\Développements\Dev Electronic Blu-ray\Électronique_Drawer_controler_2018-01-07_Drawer_controler_2018-01-07.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Franck\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -ide-version=10805 -build-path C:\Users\Franck\AppData\Local\Temp\arduino_build_221932 -warnings=none -build-cache C:\Users\Franck\AppData\Local\Temp\arduino_cache_5299 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Franck\Dropbox\Mes documents_PROFESSIONNEL_Entreprises_Raspberry Scientific_Équipe Dévelopement Raspberry\Développements\Dev Electronic Blu-ray\Électronique_Drawer_controler_2018-01-07_Drawer_controler_2018-01-07.ino
Using board ‘nano’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs” “C:\Users\Franck\AppData\Local\Temp\arduino_build_221932\sketch_Drawer_controler_2018-01-07.ino.cpp” -o “nul”
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs” “C:\Users\Franck\AppData\Local\Temp\arduino_build_221932\sketch_Drawer_controler_2018-01-07.ino.cpp” -o “C:\Users\Franck\AppData\Local\Temp\arduino_build_221932\preproc\ctags_target_for_gcc_minus_e.cpp”
C:\Users\Franck\Dropbox\Mes documents_PROFESSIONNEL_Entreprises_Raspberry Scientific_Équipe Dévelopement Raspberry\Développements\Dev Electronic Blu-ray\Électronique_Drawer_controler_2018-01-07_Drawer_controler_2018-01-07.ino:24:22: fatal error: avr/io.h : No such file or directory

compilation terminated.

exit status 1
Erreur de compilation pour la carte Arduino Nano

I tried to put the AVR Lib in the Arduino’s libraries folder and I also tried to add the files in my projet but nothing seems to work. What should I do to be able to use the :

avr io.h

and

avr interrupt.h

librairies?

…I dont think it will help you more but here is my actual code :

/****************************************************************************** 
Raspberry Scientific Inc.
François-Olivier Mc Duff
Code de contrôle de l'ouverture et de la fermeture automatique du tiroir de chargement du lecteur Blu-Ray
Le moteur DC 1 phase est alimenté par un H-Bridge SN754410NE à une tension de 5V pour réduire la vitesse d'opération
et le H-Bridge SN754410NE est contrôlé par trois signaux dont deux provenant d'un couple entrée/sortie d'un Hex-Inverter SN7404N 
commandé par un unique signal VCC/GND venant du microcontrôleur et indiquant la direction, puis le troisième signal provenant du
microcontrôleur pour enabler les canaux 1-2 du H-Bridge

La commande d'ouverture est envoyée au microcontrôleur par un pushbutton sur une pin Interrupt du microcontrôleur,
et la durée d'activation du moteur pour l'ouverture/fermeture est limité par une contact switch 2 voies signalant les limites en VCC

******************************************************************************/
//Declare pin functions on Nano
#define Button 2
#define OpenS 3
#define CloseS 4
#define DIR A0
#define EN A1


// Definition of interrupt names
#include < avr/io.h >
// ISR interrupt service routine
#include < avr/interrupt.h >


// LED connected to digital pin 13
int ledPin = 13;
// This is the INT0 Pin of the ATMega8
int sensePin = 2;
// We need to declare the data exchange
// variable to be volatile - the value is
// read from memory.
volatile int value = 0;

// Install the interrupt routine.
ISR(INT0_vect) {
  // check the value again - since it takes some time to
  // activate the interrupt routine, we get a clear signal.
  value = digitalRead(sensePin);
  
  if(digitalRead(OpenS) == 1){
    digitalWrite(DIR, HIGH); 
    digitalWrite(EN, HIGH);
    while(digitalRead(CloseS) != 1){
      delay(100);
      }
    digitalWrite(EN, LOW);    
    }
  else{
    digitalWrite(DIR, LOW);
    digitalWrite(EN, HIGH);    
    while(digitalRead(OpenS) != 1){
      delay(100);
      }
    digitalWrite(EN, LOW);    
    }
    
}


void setup() {
  //Serial.begin(9600);
  //Serial.println("Initializing ihandler");
  // sets the digital pin as output
  pinMode(ledPin, OUTPUT);
  // read from the sense pin
  pinMode(sensePin, INPUT);

  pinMode(OpenS, INPUT);
  pinMode(CloseS, INPUT);
  pinMode(DIR, OUTPUT);
  pinMode(EN, OUTPUT);
  
  //Serial.println("Processing initialization");
  // Global Enable INT0 interrupt
  GICR |= ( 1 < < INT0);
  // Signal change triggers interrupt
  MCUCR |= ( 1 << ISC00);
  MCUCR |= ( 0 << ISC01);
  //Serial.println("Finished initialization");
}

void loop() {
  if (value) {
    //Serial.println("Value high!");
    digitalWrite(ledPin, HIGH);
  } else {
    //Serial.println("Value low!");
    digitalWrite(ledPin, LOW);
  }
  delay(100);
}

And here is my Arduino Librairies folder

Any help will be greatly appreciated!
Thanks
Frank

fomcduff:

#include < avr/io.h >

// ISR interrupt service routine
#include < avr/interrupt.h >

You need to remove the spaces inside the angle brackets:

#include <avr/io.h>
// ISR interrupt service routine
#include <avr/interrupt.h>

Thanks Pert it works! :wink:

Now it pass the Librairies but compiler bloc at

GICR' was not declared in this scope

I found this tread about that problem but it look to harsh for me

http://forum.arduino.cc/index.php?topic=40665.0

Since I'm not a pro I think I must change my idea and use the attachinterrupt in place of the avr...

https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

That look way more easy...

Thanks for your help

Frank

#include <SoftwareSerial.h>
#include<avr\interrupt.h>
SoftwareSerial mySerial(10, 11);
SoftwareSerial mySerial(3,2);
String inputString = “”; // a string to hold incoming data
long int counter = 0;
String cmd = “”;
//////////////
#include “pitches.h”
int melody = {
NOTE_C4, NOTE_G3
};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations = {15,5};

////////////////////////

#include “EmonLib.h” // Include Emon Library

#include “FastLED.h”
#define NUM_LEDS 16 // LED strips number
#define DATA_PIN 9
CRGB leds[NUM_LEDS];
//////////////

#include “VirtualWire.h”
const int led_pin = 13;
const int transmit_pin = 1;
const int receive_pin = 6;
const int transmit_en_pin = 4;

const long interval = 1000;

unsigned long crtime; // use in milli func.
unsigned long trigertime = 0;
unsigned long previousMillis = 0; // will store last time LED was updated
int ledState = LOW;

int inByte;

void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
Serial.begin(9600);
}

void loop() {
if (Serial.available() > 0) {
Serial.println(inByte);
if (mySerial.available() > 0) {

inByte = mySerial.read();
Serial.println(inByte);

if (inByte == ‘9’) { // LED ON and OFF for 1 sec.
Serial.println(“LED ON”);
ledon();
delay(50);
ledoff();
Rgb();
delay(10);
cgb();
delay(10);
ledoff();

}
}

else if (inByte == ‘2’) { // LED go and come back func.
Serial.println(“LED Line”);
Rgb();
}

else if (inByte == ‘3’) { // 6 LED run one by one
Serial.println(“6 LED runs”);
half();
}
ourdelay(our_delay_trigger); // our own delay by default this delay runs
}
}
void ledon() {

for (int i = 0; i < 25; i++) {
leds = CRGB::Red;

  • FastLED.show();*
  • }*
    trigertime = millis();
    }
    void ledoff() {
  • Serial.println(“LED OFF”);*
  • for (int i = 25; i >= 0; i–) {*
    _ leds = CRGB::Black;_
    * FastLED.show();*
    * }*
    }
    void Rgb() {

* for (int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed++) {
_
Serial.println(whiteLed);_
_
FastLED.show();_
_
leds[whiteLed] = CRGB::Red;_
_
}_
_
}_
void cgb() {
_
Serial.println(millis());_
for (int i =0 ; i < NUM_LEDS; i++) {
_
Serial.println(i);_
_ leds = CRGB::Black;
FastLED.show();
}
}
void speaker(){
for (int thisNote = 0; thisNote < 2; thisNote++) {
// to calculate the note duration, take one second divided by the note type.
//e.g. quarter not*
* // e = 1000 / 4, eighth note = 1000 / 8, etc.
int noteDuration = 1000 / noteDurations[thisNote];
tone(8, melody[thisNote], noteDuration);
// to distinguish the notes, set a minimum time between them.
// the note’s duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// stop the tone playing:
noTone(8);
}
}
void ourdelay(int dela) {
crtime = millis();
if (crtime - trigertime >= dela) {
ledoff();
}
}*_

@vijayakrishnankarthas

Please learn to use the code tags ( </> ).
As you can see your sketch has been changed by the forum because it is not formatted correctly.

Do you have an actual question to go with your sketch ?