Notifications
Clear all

Ao2YYUW sketch

6 Posts
2 Users
0 Reactions
158 Views
(@miken58)
Member
Joined: 4 weeks ago
Posts: 2
Topic starter  

I cannot fix this compilation error:

D:\B_Up ACER\Documents\ELECTRONICS\ESP32C3_sketch_A02yy\ESP32C3_sketch_A02yy.ino:17:10: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: avr/interrupt.h: No such file or directory

Please help!

 


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

Posted by: @miken58

I cannot fix this compilation error:

D:\B_Up ACER\Documents\ELECTRONICS\ESP32C3_sketch_A02yy\ESP32C3_sketch_A02yy.ino:17:10: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: avr/interrupt.h: No such file or directory

Please help!

 

Not a lot of information to go on but have you installed the AVR boards?

If that doesn't help. give us the link to the sketch you copied.

Umm, I just tried to compile an empty sketch with that line added and it fails too. 

We will need to see the original code and context.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@miken58)
Member
Joined: 4 weeks ago
Posts: 2
Topic starter  

So I loaded up ArduinoIDE 1.8.9 and the sketch compiled and uploaded perfectly. 😉 

/*

  JSN-SR04T-V3.0 Ultrasonic Sensor - Mode 1 Demo

  srt04-mode1.ino

  Uses JSN-SR04T-V3.0 Ultrasonic Sensor

  Displays on Serial Monitor

 

  Mode 1 is set by bridging "M1" pads on board

 

  Also works with A02YYUW Ultrasonic Sensor

 

  DroneBot Workshop 2021

   https://dronebotworkshop.com

*/

 

// Include the Software Serial library

#include <SoftwareSerial.h>

 

// Define connections to sensor

int pinRX = 10;

int pinTX = 11;

 

// Array to store incoming serial data

unsigned char data_buffer[4] = {0};

 

// Integer to store distance

int distance = 0;

 

// Variable to hold checksum

unsigned char CS;

 

// Object to represent software serial port

SoftwareSerial mySerial(pinRX, pinTX);

 

void setup() {

  // Set up serial monitor

  Serial.begin(115200);

  // Set up software serial port

  mySerial.begin(9600);

}

 

void loop() {

 

  // Run if data available

  if (mySerial.available() > 0) {

 

    delay(4);

 

    // Check for packet header character 0xff

    if (mySerial.read() == 0xff) {

      // Insert header into array

      data_buffer[0] = 0xff;

      // Read remaining 3 characters of data and insert into array

      for (int i = 1; i < 4; i++) {

        data_buffer[i] = mySerial.read();

      }

 

      //Compute checksum

      CS = data_buffer[0] + data_buffer[1] + data_buffer[2];

      // If checksum is valid compose distance from data

      if (data_buffer[3] == CS) {

        distance = (data_buffer[1] << 8) + data_buffer[2];

        // Print to serial monitor

        Serial.print("distance: ");

        Serial.print(distance);

        Serial.println(" mm");

      }

    }

  }

}

Gee! it would be nice if Arduino provided a list of things that they break when the do an upgrade of the IDE. 😡 

I am coming to the conclusion that IDE versions, board versions and managers, libraries are a giant maze! Oh how I wish that there was something better.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@miken58 Ummm, the ver 1 IDE has not been upgraded in many years. All the stuff you mention is common to both IDE's. Not being a professional programmer you will not know that an IDE is simply a fancy GUI that invokes the command line program comon to both IDE's and uses all the same libraries and even most of the misc files.

The board manager is simple, it's something you usually do once to install a new board like the recent UNO R4. Libraries of course we are adding and possiblt removing fairly often.

I will admit choosing one of several similar sounding libraries is part science, part art. If in doubt, ask. Experienced folks know some of the authors so if you have a choice of two and one is by Khoi Hoang and is to do with comms, then that is likely a good choice.

Please read the help and learn how to post code, thank you.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

Posted by: @miken58

I cannot fix this compilation error:

D:\B_Up ACER\Documents\ELECTRONICS\ESP32C3_sketch_A02yy\ESP32C3_sketch_A02yy.ino:17:10: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: avr/interrupt.h: No such file or directory

Please help!

 

I just noticed, you appear to be working with an ESP32C3 board, but the avr libraries are Arduino ONLY! See attached pic

Screenshot 2024 05 07 at 10.29.37

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@miken58 Is your issue resolved? I plan on stepping away from the forum but want to close any outstanding issues.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote