How to detect short circuit?

huguyuge
Posts: 3
Joined: Fri Mar 01, 2019 8:37 am

How to detect short circuit?

Postby huguyuge » Tue Sep 24, 2019 11:03 am

Hi,

How to detect if some pin is short-circuited? I tried to google `esp idf short circuit` but got nothing useful. Could you please give me some guidance? documents, links, etc.

Thank you

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

Re: How to detect short circuit?

Postby KanyeKanye » Thu Sep 26, 2019 5:06 pm

Code: Select all

void initialise() {
	gpio_pad_select_gpio(PIN_NUM);
	gpio_set_direction(PIN_NUM, GPIO_MODE_INPUT);
	gpio_set_pull_mode(PIN_NUM, GPIO_PULLUP_ONLY);

	xTaskCreatePinnedToCore(&task, "task", 2048, NULL, TASK_PRIORITY, NULL, TASK_CORE_ID);
}
void task(void *pvParameters) {
	TickType_t xLastWakeTime = xTaskGetTickCount();
	while (1) {
		if (gpio_get_level(PIN_NUM) == 0) {
			// ...
		}
		vTaskDelayUntil(&xLastWakeTime, 50 / portTICK_RATE_MS);
	}
}

Who is online

Users browsing this forum: No registered users and 129 guests