Re: samples/basic/blinky


Tristen Ennemuist
 

cheers lawrence i've been tinkering and i can confirm the following will behave as i originally expected, all four leds are initially off and then cycling through 'em in turn. i'm in the right universe after all, thank you!

gpio_pin_configure(green_led, DT_ALIAS_LED0_GPIOS_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW);
gpio_pin_configure(orange_led, DT_ALIAS_LED1_GPIOS_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW);
gpio_pin_configure(red_led, DT_ALIAS_LED2_GPIOS_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW);
gpio_pin_configure(blue_led, DT_ALIAS_LED3_GPIOS_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW);

u32_t counter = 0;

while (1)
{
counter++;

if (counter == 1)
{
printk("green on\n");

gpio_pin_set(green_led, DT_ALIAS_LED0_GPIOS_PIN, 1U);
gpio_pin_set(orange_led, DT_ALIAS_LED1_GPIOS_PIN, 0U);
gpio_pin_set(red_led, DT_ALIAS_LED2_GPIOS_PIN, 0U);
gpio_pin_set(blue_led, DT_ALIAS_LED3_GPIOS_PIN, 0U);
}

if (counter == 2)
{
printk("orange on\n");

gpio_pin_set(green_led, DT_ALIAS_LED0_GPIOS_PIN, 0U);
gpio_pin_set(orange_led, DT_ALIAS_LED1_GPIOS_PIN, 1U);
gpio_pin_set(red_led, DT_ALIAS_LED2_GPIOS_PIN, 0U);
gpio_pin_set(blue_led, DT_ALIAS_LED3_GPIOS_PIN, 0U);
}

if (counter == 3)
{
printk("red on\n");

gpio_pin_set(green_led, DT_ALIAS_LED0_GPIOS_PIN, 0U);
gpio_pin_set(orange_led, DT_ALIAS_LED1_GPIOS_PIN, 0U);
gpio_pin_set(red_led, DT_ALIAS_LED2_GPIOS_PIN, 1U);
gpio_pin_set(blue_led, DT_ALIAS_LED3_GPIOS_PIN, 0U);
}

if (counter == 4)
{
printk("blue on\n");

gpio_pin_set(green_led, DT_ALIAS_LED0_GPIOS_PIN, 0U);
gpio_pin_set(orange_led, DT_ALIAS_LED1_GPIOS_PIN, 0U);
gpio_pin_set(red_led, DT_ALIAS_LED2_GPIOS_PIN, 0U);
gpio_pin_set(blue_led, DT_ALIAS_LED3_GPIOS_PIN, 1U);

counter = 0;
}

k_sleep(1000);
}

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