<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configuration of Digital Input/Output pins on nRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19242/configuration-of-digital-input-output-pins-on-nrf52</link><description>Hello everybody, I&amp;#39;m new to the Nordic system and the nRF52. I&amp;#39;m trying to become familiar with the board and I want to be able to read different 4 input pins, each one attached to the LEDs. In few words, I&amp;#39;m looking to do something like this. 
 if(button_1</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Jan 2017 21:39:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19242/configuration-of-digital-input-output-pins-on-nrf52" /><item><title>RE: Configuration of Digital Input/Output pins on nRF52</title><link>https://devzone.nordicsemi.com/thread/74548?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2017 21:39:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57b38265-b156-4f39-8c4c-be4d58a35608</guid><dc:creator>anfedres</dc:creator><description>&lt;p&gt;I was looking something like &lt;a href="https://devzone.nordicsemi.com/tutorials/13/"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I have done my own code. Sorry if the question was too simple, sometimes libraries fail starting from the most basic example.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_drv_gpiote.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;


#define GPIO_PIN_17     17
#define GPIO_PIN_18     18
#define GPIO_PIN_19     19
#define GPIO_PIN_20     20

#define GPIO_PIN_27     27
#define GPIO_PIN_28     28
#define GPIO_PIN_29     29
#define GPIO_PIN_30     30

#define S_ON     1
#define S_OFF    0



void gpio_init(void)
{

			// Pins as outputs
	    nrf_gpio_range_cfg_input(27,30,NRF_GPIO_PIN_PULLUP);
	
			// Pins as inputs
			nrf_gpio_range_cfg_output(17, 20);
			
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpio_init();

    while (true)
    {
			
			if(nrf_gpio_pin_read(GPIO_PIN_27))
			{
				nrf_gpio_pin_write(GPIO_PIN_17, S_OFF);
			}
			else
			{
				nrf_gpio_pin_write(GPIO_PIN_17, S_ON);
			}
			
			if(nrf_gpio_pin_read(GPIO_PIN_28))
			{
				nrf_gpio_pin_write(GPIO_PIN_18, S_OFF);
			}
			else
			{
				nrf_gpio_pin_write(GPIO_PIN_18, S_ON);
			}
			
			if(nrf_gpio_pin_read(GPIO_PIN_29))
			{
				nrf_gpio_pin_write(GPIO_PIN_19, S_OFF);
			}
			else
			{
				nrf_gpio_pin_write(GPIO_PIN_19, S_ON);
			}
			
			if(nrf_gpio_pin_read(GPIO_PIN_30))
			{
				nrf_gpio_pin_write(GPIO_PIN_20, S_OFF);
			}
			else
			{
				nrf_gpio_pin_write(GPIO_PIN_20, S_ON);
			}
	
 
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>