[SOVLED] Grove Button doesn't work properly

I have connected the Grove Button to Grove PI running on up-squared board. I have written a small code using mraa to detect key press/release.

Working Scenario:
Here is my sample code:

mraa_add_subplatform(MRAA_GROVEPI, "0");
dev=mraa_gpio_init(BUTTON_PIN);
mraa_gpio_dir(dev, MRAA_GPIO_IN);
while (true)
{
   fprintf(stdout, mraa_gpio_read(dev));
}

where BUTTON_PIN = 516 (connected to D4).

Problem scenario:

  1. Grove Button connected to D7, BUTTON_PIN=519 (D7) : Doesn’t detect the key press/release
  2. Grove Button connected to D4, BUTTON_PIN=519, key press/release is detected.

i.e independent of the ‘pin_no’ passed to the initialization, the key press/release is detected only on D4 (516).

Hi @bindu,

Since the current firmware v1.2.7 works just fine with the current library written in Python when used with buttons, I can only assume there’s something different with the underlying library that you have.

Maybe if you can show us the implementation of your library, maybe then we can understand what’s going bad with it.

Regarding the current firmware of the GrovePi, I would advise you to use our pre-release version v1.3.0 because this new one is more stable than the previous. You can see more of this new release that’s going to get released here, on this thread:

Thank you!

Hi Robert,

Thanks for the information. I have an update on this, the problem is resolved. It appeared to be a power glitch probably as there was continuous read call from GPIO 516 (info. from System logs), which is not logged anymore.

However, I am curious to understand the way to find the GrovePI firmware version.
I am using GrovePI, which is available as part of Intel-iot-devkit (UP Squared Board with Grove PI). I have no clue of the GrovePI firmware version used. On looking at mraa sources, i see that GrovePI version is set to v1.2.7, which should be ok. Could you let me know the way to find the firmware version and upgrade(if need be) on UP Squared board please?

Hi @bindu,

There’s a version function in the grovepi.py script that you can port to your library. Here it is:

This function will return the version of the firmware sitting on the GrovePi.

Thank you!

Thanks Robert, will have a look.

This topic could be closed as the problem mentioned has been addressed.