Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
910 Views

When I initilize SPI_0 the onboard LED no longer blinks

Hi,

The code below blinks the onboard led on the Edison board.

Could somebody explain to me why when initialize SPI 0 (commented out in the code below) - the LED no longer blinks?

Am I doing something stupid?

Thanks

# include

# include

# include

int main()

{

// select onboard LED pin based on the platform type

// create a GPIO object from MRAA using it

mraa_platform_t platform = mraa_get_platform_type();

mraa_gpio_context d_pin = NULL;

mraa_spi_context spi = NULL;

switch (platform) {

case MRAA_INTEL_GALILEO_GEN1:

d_pin = mraa_gpio_init_raw(3);

break;

case MRAA_INTEL_GALILEO_GEN2:

d_pin = mraa_gpio_init(13);

break ;

case MRAA_INTEL_EDISON_FAB_C:

d_pin = mraa_gpio_init(13);

/*

spi = mraa_spi_init(0);

if (spi == NULL) {

fputs("Unable to initialize SPI 0 interface\n", stderr);

return 1;

}

*/

break;

case MRAA_INTEL_GT_TUCHUCK:

d_pin = mraa_gpio_init(100);

break;

default:

fprintf(stderr, "Unsupported platform, exiting");

return MRAA_ERROR_INVALID_PLATFORM;

}

if (d_pin == NULL) {

fprintf(stderr, "MRAA couldn't initialize GPIO, exiting");

return MRAA_ERROR_UNSPECIFIED;

}

// set the pin as output

if (mraa_gpio_dir(d_pin, MRAA_GPIO_OUT) != MRAA_SUCCESS) {

fprintf(stderr, "Can't set digital pin as output, exiting");

return MRAA_ERROR_UNSPECIFIED;

};

// loop forever toggling the on board LED every second

for (;;) {

mraa_gpio_write(d_pin, 0);

sleep(1);

mraa_gpio_write(d_pin, 1);

sleep(1);

}

return MRAA_SUCCESS;

}

0 Kudos
2 Replies
idata
Community Manager
17 Views

Hello conor100,

 

 

Thank you for interest in the Intel® Edison Breakout Board.

 

 

While doing research, I saw that you opened another thread a while ago, https://communities.intel.com/thread/110309?start=15&tstart=0 https://communities.intel.com/thread/110309?start=15&tstart=0, in it, you mention using Ubuntu 16.04, which unfortunately is not supported.

 

 

Could you please confirm which OS you are using before trying any troubleshooting?

 

 

Regards,

 

Andres
idata
Community Manager
17 Views

Hello conor100,

 

 

Could you please confirm which OS you are using?

 

 

Regards,

 

Andres
Reply