Skip to content

Instantly share code, notes, and snippets.

@rustyeddy
Created May 19, 2019 20:31
Show Gist options
  • Save rustyeddy/90969a5a96bec6daf03f14d1d04093d7 to your computer and use it in GitHub Desktop.
Save rustyeddy/90969a5a96bec6daf03f14d1d04093d7 to your computer and use it in GitHub Desktop.
ESP32 C++ main_app
// ====================================================================
const int STACK_SIZE = 256;
const gpio_num_t LED_RED = GPIO_NUM_22;
const gpio_num_t LED_GREEN = GPIO_NUM_23;
// GLobal LEDs
// ====================================================================
LED red = LED(LED_RED);
LED green = LED(LED_GREEN);
void app_main() {
int keep_going = 1;
int delay = 100; // micro-seconds (1/100)
printf("Starting the stinky blinker \n");
red.on();
green.off();
printf(" lights are on ...\n");
unsigned int loop;
unsigned int overflows = -1;
for (loop = 1; keep_going; loop++) {
// we don't care about no sinking overflows!
if (loop == 1) overflows++; // overflows will start as
printf(" loop[%d - %d]\n", overflows, loop);
red.toggle();
green.toggle();
vTaskDelay(delay);
}
printf("Goodbye Cruel Loop!\n");
vTaskDelete(NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment