i am wondering why my code doesn't work:
Code: Select all
#include <osapi.h>
#include <ets_sys.h>
#include <gpio.h>
#include "user_interface.h"
#include "eagle_soc.h"
os_timer_t timer;
void toggleGPIO(void){
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & BIT10)
{
gpio_output_set(0, BIT10, BIT10, 0);
os_printf("SET BIT10 to low.\n");
}
else
{
gpio_output_set(BIT10, 0, BIT10, 0);
os_printf("SET BIT10 to high.\n");
}
}
void user_init(void){
os_timer_setfn(&timer,(os_timer_func_t*)toggleGPIO,NULL);
os_timer_arm(&timer,1000,1);
}
I get alternating "SET BIT10 to high" and "SET BIT10 to low" on my serial console but in reality, GPIO10 is high all the time and never low. Why is that?