audio scope



  • Always when i try to run the code of the Audio Scope sample project i get those weared error messages like this:

    In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\TFT\src\utility\Adafruit_GFX.cpp:35:0:

    C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\TFT\src\utility\glcdfont.c:3:20: fatal error: avr/io.h: No such file or directory

    When i try to solve those problems by installing libraries, then the next error shows up.
    I tried to clean up the library folder by deleting it and reinstall the required libraries step for step but every time the same errors show up.
    I tried to install the libraries manually, semi-automatic and automatic with the sketch manager.
    I have installed the next libraries:

    Adafruit-ST7735-Library-master
    Adafruit-GFX-Library-master
    TFT-spresense-st7735

    But what i try it doesn't work.
    Every time I add a Library I get a new error message and when i delete it too.
    I did the git command, and then my computer says the folder is already installed and the files too.
    What am i doing wrong?
    Can you help me?

    A desperate Marc!


  • DeveloperWorld

    Hi @JCPStevens ,

    Ok, let's sort this out once for all.

    I did the following on a Ubuntu machine to get this to work:

    git clone --recursive git@github.com:TE-KarlKomierowski/hackster_projects.git
    
    

    After that I opened Arduino IDE and from the Sketch menu I took Include library->Add .ZIP library
    In the file browser I selected the folder in the git repo as follows:

    ~/hackster_projects/spresense-audio-scope/arduino-lib
    I selected TFT folder and clicked OK

    I then opened arduino-scope-ino in the Arduino IDE and pressed the button Verify to build the sketch.

    This failed. It turns out that the TFT library defines a macro that is named swap and this is later being used in other libraries which confuses the build system.

    The quickes way to get around this for me was to simply add the following on line 7 to the arduino-scope.ino sketch:

    #undef swap
    

    The undef part must be between the include <TFT> and include <Audio.h>

    #include <TFT.h> /* Include TFT.h first, then Audio.h to avoid __SD_H__ being defined in the Audio.h. */
    #undef swap
    #include <Audio.h>
    

    After doing this I can build the sketch.
    I have been using a Ubuntu PC with Arduino IDE version 1.8.9.

    I have built for target Spresense.

    Hope that this will work for you too.
    If you run into problems, please past your errorlog into your post and I will try to help out.