samples/basic/blinky


Tristen Ennemuist
 

hello, i am [slowly] working my way through the examples, and i am a bit confused with the blinky sample project.

it seems that when 0 (zero) is written using gpio_pin_set then the LED on my board lights up and when 1 (one) is written the LED turns off. this is the opposite of what i was expecting,

however i am completely new to embedded development so i must apologise in embarrassment if it is my expectation that is the opposite!

ok, with the code:

i increased SLEEP_TIME_MS to 10000 so i could be sure there wasn't a timing issue on the output and i added the if/printk block to the while loop, and sure enough writing a zero results in led on and writing a one results in led off.

ie: the led is unlit and "led is now on", the led is lit and "led is now off".

my board is the stm32f469i_disco and i'm developing on fedora, below is the modified while loop, any feedback/advice would be much appreciated, thank you.

 while (1) {
gpio_pin_set(dev, PIN, (int)led_is_on);

if (led_is_on)
{
printk("led is now on\n");
}
else
{
printk("led is now off\n");
}

led_is_on = !led_is_on;
k_sleep(SLEEP_TIME_MS);
}  

Join users@lists.zephyrproject.org to automatically receive all group messages.