New answers tagged

2

Make 2 global variables called tick and previousTick, or whatever you want, and inside the timer ISR increment the tick variable by 1. then check if the difference between this tick and previous tick is larger than a value of your choice then consider the button debounced, otherwise if the difference of this tick and previousTick is not large enough then ...


2

This line looks suspect: EXTI->PR |= EXTI_PR_PR13; The user manual tells you to write a '1' bit to clear the interrupt. That line does not quite do what you expect. Why you might ask? The register you read is not the same register you write. This is why doing a read/modify/write is not correct in this situation. the required code is: EXTI->PR = ...


0

Replace for (int rows = 0; rows < NUM_ROWS; rows++) { if (HAL_GPIO_ReadPin(GPIOD, keyscan_row_io[rows].pin)) key_state [rows * NUM_ROWS + cols] = KEY_DOWN; else key_state [rows * NUM_ROWS + cols] = KEY_UP; } with for (int rows = 0; rows < NUM_ROWS; rows++) { if (...


0

Answer: reduce oscilloscope scale frequency.The signal will build up slowly but retain its shape.


0

I think I solved the problem. I can't say that I did a very big job, but I tried to launch all the DHT functions one after the other, and see if the main loop gets stuck. The code did not crash at any point. Then I slightly changed the functions of DHT sensor, and then the whole sequence of DHT code was like this: uint8_t Rh_byte1, Rh_byte2, Temp_byte1, ...


Top 50 recent answers are included