HimaxWiseEyePlus / Seeed_Grove_Vision_AI_Module_V2

MIT License
30 stars 18 forks source link

Using a button #24

Closed cyxl closed 4 days ago

cyxl commented 1 week ago

Can we have an example of using a button with the Grove Vision AI V2

stevehuang82 commented 6 days ago

Hi @cyxl,

You can refer to EPII_CM55M_APP_S/drivers/inc/hx_drv_gpio.h to set PA0(D0) to GPIO input mode as button input.

For example, Usage-2: Use AON_GPIO0 as an input pin with rising edge to trigger interrupt. You can change interrupt type to rising and falling edge (GPIO_IRQ_TRIG_TYPE_EDGE_BOTH) to trigger interrupt.

In our experience, there is some bounce pulse when pressing the button, and you'll have to deal with the bounce yourself.

stantonious commented 6 days ago

I don't see a pull-up resistor mode for input. Do I need to add a resistor and if so what size?

stevehuang82 commented 6 days ago

You can add a 10K resistor to the circuit as shown below. pa0_with_button

stantonious commented 6 days ago

Perfect! Thanks again