[MinnowBoard] GPIO doesn't working as Input
Jesus Velazquez
jjvema at gmail.com
Thu Jul 6 21:51:29 UTC 2017
Hi Van,
I have Ubuntu 16.04 with kernel version:
Linux blackbox 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux
And I has have test with Pulsar Linux 7 with kernel 3.18.x
My libraries that I use is MRAA Version: v1.7.0-44-gbd3d9d8 (
https://iotdk.intel.com/docs/master/mraa/ )
I have tried with Pins 26, 25, 21, 20 and 14.
This is my code:
---
#include "mraa/gpio.h"
int main(){
/* initialize MRAA */
mraa_init();
/* create an MRAA digital context */
mraa_gpio_context m_gpio = NULL;
/* initialize D2 for use as a digital pin */
m_gpio = mraa_gpio_init(26);
/* configure the digital pin as an input */
mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
/* Set Gpio input mode */
mraa_gpio_input_mode(m_gpio, MRAA_GPIO_ACTIVE_LOW);
/* read the value into an integer */
int value = mraa_gpio_read(m_gpio);
/* print the value */
if (value != 0)
printf("The button is being pushed %d\n", value);
else
printf("The button is not being pushed %d\n", value);
/* now release (close) the pin and exit */
mraa_gpio_close(m_gpio);
return(0);
}
---
Thank you for your help
Jesus V
2017-07-06 14:42 GMT-05:00 Van Der Pol, MarkX <markx.van.der.pol at intel.com>:
> Hi Jesus,
>
> Welcome to the list.
>
>
>
> Please let me know the OS and libraries you are using to access the GPIO
> pin in question, and what program you use to test the GPIO state.
>
>
>
> And is it specifically GPIO 26, or are all GPIO’s behaving this way?
>
>
>
> Thanks,
>
> |\/|ark
>
>
>
> *From:* elinux-MinnowBoard [mailto:elinux-minnowboard-
> bounces at lists.elinux.org] *On Behalf Of *Jesus Velazquez
> *Sent:* Wednesday, July 5, 2017 9:14 AM
> *To:* elinux-minnowboard at lists.elinux.org
> *Subject:* [MinnowBoard] GPIO doesn't working as Input
>
>
>
> Hello list,
>
>
>
> This is my first post in this list and I'm happy for join me to it.
>
>
>
> I have a Minnowboard Turbot and I would like to manage a GPIO as input but
> I can see that my pin (26 for example) always is in HIGH state and the
> interruption never is active.
>
>
>
> If I use the GPIO as output, it works fine and can change the state, but
> as Input not.
>
>
>
> Somebody have the same experience? or can resolve this issue?
>
>
>
> Thanks in advance.
>
>
>
>
>
> _______________________________________________
> elinux-MinnowBoard mailing list
> elinux-MinnowBoard at lists.elinux.org
> http://lists.elinux.org/mailman/listinfo/elinux-minnowboard
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.elinux.org/pipermail/elinux-minnowboard/attachments/20170706/14c36ee7/attachment-0001.html>
More information about the elinux-MinnowBoard
mailing list