users Digest, Vol 21, Issue 14

Thank you for the answers. It worked with thread.h. One more question, the time delay for a blink led for instance is “hwtimer_wait”? Because when I use it the operating system enters in the error mode (red led blinks). I never got out of hwtimer_wait(), there are another timer delay function to use?

There is my code

#include <stdio.h> #include “cpu.h” #include “periph_conf.h” #include “gpio.h” #include “vtimer.h” #include “hwtimer.h” #include “thread.h” #include “board.h” #include “main.h” /* only compile this if at least one GPIO device is defined */ uint32_t state = 0; uint32_t old_state = 0; char run_stack[10]; void *run(void *parameter) { LED_BLUE_TOGGLE; while (1) { LED_GREEN_TOGGLE; LED_BLUE_TOGGLE; hwtimer_wait(1000000); // < When I remove hwtimer_wait it works but without blink } return NULL; } int main(void) { gpio_init_out(21, GPIO_NOPULL); gpio_init_out(22, GPIO_NOPULL); gpio_init_out(23, GPIO_NOPULL); (void) thread_create(run_stack, sizeof(run_stack),PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, run, NULL, “run”); return 0; }