Grove EMG zip file unable to be downloaded onto Arduino IDE

Hi, I am trying to use the Grove EMG detector to give readings about muscle activity/use an LED, but I can't install the demo code shown on the detector site.

The error message I'm getting is

Error: Request installZip failed with message: 13 INTERNAL: Library install failed: library not valid

and this is where I found the demo code.

I've looked elsewhere for other zip libraries that I might be able to download, but I haven't been able to find any yet.

Thank you :slight_smile:

Do not download it as library, download demo code only:

There is no library. You red analog values directly from an analog input pin (A0 in the example).

Apologies but I'm very new to Arduino - do I not need a library for the code to run? Do I just put this demo code into IDE and run it?

No, you don't.

I appreciate your help, but Im still having problems with the code. I downloaded the Grove LED library and included that into the demo code, but when I upload, Im getting this error message:

and this is my code:

// Grove - EMG Sensor demo code
// This demo will need a Grove - Led Bar to show the motion 
// Grove - EMG Sensor connect to A0
// Grove - LED Bar connect to D8, D9
// note: it'll take about serval seconds to detect static analog value
// when you should hold your muscle static. You will see led bar from level 10 turn to 
// level 0, it means static analog value get ok

#include <Grove_LED_Bar.h>

Grove_LED_Bar bar(9, 8);

int max_analog_dta      = 300;              // max analog data
int min_analog_dta      = 100;              // min analog data
int static_analog_dta   = 0;                // static analog data


// get analog value
int getAnalog(int pin)
{
    long sum = 0;
    
    for(int i=0; i<32; i++)
    {
        sum += analogRead(pin);
    }
    
    int dta = sum>>5;
    
    max_analog_dta = dta>max_analog_dta ? dta : max_analog_dta;         // if max data
    min_analog_dta = min_analog_dta>dta ? dta : min_analog_dta;         // if min data
    
    return sum>>5;
}

void setup()
{
    Serial.begin(115200);
    
    long sum = 0;

    for(int i=0; i<=10; i++)
    {
        for(int j=0; j<100; j++)
        {
            sum += getAnalog(A0);
            delay(1);
        }
        
        bar.setLevel(10-i);
    }
    
    sum /= 1100;
    
    static_analog_dta = sum;

    Serial.print("static_analog_dta = ");
    Serial.println(static_analog_dta);
}

int level       = 5;
int level_buf   = 5;

void loop()
{

    int val = getAnalog(A0);                    // get Analog value
    
    int level2;
    
    if(val>static_analog_dta)                   // larger than static_analog_dta
    {
        level2 = 5 + map(val, static_analog_dta, max_analog_dta, 0, 5);
    }
    else 
    {
        level2 = 5 - map(val, min_analog_dta, static_analog_dta, 0, 5);
    }
    
    // to smooth the change of led bar
    if(level2 > level)
    {
        level++;
    }
    else if(level2 < level)
    {
        level--;
    }

    if(level != level_buf)
    {
        level_buf = level;
        bar.setLevel(level);
    }
    
    delay(10);
}

this is a text copy of the error message

/private/var/folders/8s/qnlng3s133b7lfstqvt7qlpn36ypfn/T/.arduinoIDE-unsaved20221022-3373-nspugl.qchd/sketch_nov22a/sketch_nov22a.ino:13:23: error: no matching function for call to 'Grove_LED_Bar::Grove_LED_Bar(int, int)'
Grove_LED_Bar bar(9, 8);
^
In file included from /private/var/folders/8s/qnlng3s133b7lfstqvt7qlpn36ypfn/T/.arduinoIDE-unsaved20221022-3373-nspugl.qchd/sketch_nov22a/sketch_nov22a.ino:11:0:
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:63:3: note: candidate: Grove_LED_Bar::Grove_LED_Bar(unsigned char, unsigned char, bool)
Grove_LED_Bar(unsigned char pinClock, unsigned char pinData, bool greenToRed); // Initialize
^~~~~~~~~~~~~
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:63:3: note: candidate expects 3 arguments, 2 provided
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:47:7: note: candidate: constexpr Grove_LED_Bar::Grove_LED_Bar(const Grove_LED_Bar&)
class Grove_LED_Bar
^~~~~~~~~~~~~
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:47:7: note: candidate expects 1 argument, 2 provided
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:47:7: note: candidate: constexpr Grove_LED_Bar::Grove_LED_Bar(Grove_LED_Bar&&)
/Users/mm286502/Documents/Arduino/libraries/Grove_LED_Bar-1.0.0/Grove_LED_Bar.h:47:7: note: candidate expects 1 argument, 2 provided

exit status 1

Compilation error: no matching function for call to 'Grove_LED_Bar::Grove_LED_Bar(int, int)'

Hi @madeleinemc20. You need to install the "Grove LED Bar" library. I'll provide instructions for doing that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. In the "Filter your search" field, type Grove LED Bar
  3. Scroll down through the list of libraries until you see the "Grove LED Bar" entry.
  4. You will see an "INSTALL" button at the bottom of the entry. Click the button.
  5. Wait for the installation to finish.

It seem your code is written for a very old version of the library, so it will not compile for the modern version you just installed. You can study the example sketches that are available from the File > Examples > Grove LED Bar menu in Arduino IDE to learn the correct way to use the library.

Hi, apologies, I've already done this step and downloaded and included the library - and I used the example sketches and discovered that the library needed to be included as 'GROVE_LED_Bar' not just 'LED_Bar' so I changed it. The issue is that when I run this code with the downloaded library for the LED bar and the updated code, the system still has an issue with that line of code. When I use

#include <Grove_LED-Bar.h>

in the example sketches it works fine. I was just wondering why it wasn't working on this code.

All I'm aiming for is to get some kind of reading from the EMG sensors, it doesn't even have to include the LED bar.

Thanks for your response :slight_smile:

The library I instructed you to install does not contain a file named Grove_LED-Bar.h, so you must have installed some other library with a file of that name. The library I instructed you to install has a file named ``Grove_LED_Bar.h(notice the_instead of-). I didn't find any reference anywhere on the internet to a file named Grove_LED-Bar.h`, so I can't provide any more specific answer about this.

I think it will be a good idea to remove any unnecessary complexity from your sketch at this point in the project. That includes the LED bar.

You should remove all code related to the LED bar from your sketch and instead simply print the reading from the EMG sensors to the Arduino IDE Serial Monitor.

There is some information about printing things to Serial Monitor here:

apologies, I mistyped that :grimacing: the file is in fact Grove_LED_Bar.h

I agree that it is probably best to remove the LED bar, but I feel pretty unsure on how to write this code. Would you recommend the Arduino reference as the best place to learn this?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.