Click here to Skip to main content
15,179,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone. I'm previosly writed a code for my program. Question is same title. I'm that asking beacuse i'am in C++ writed some code to enter a password with matrix keypad (4x4). When Pico starts, i'am holding a button on matrix keyboard pre-continuous to other scene, just that time is showing a key when i'am pressed, after that no. I'm missing is that just not a wait to enter a pass on matrix keypad. Is this a helpful, this library for matrix keypad i'am got to use from github: And how to Program to wait other operation (here likely is to enter a password from matrix keypad)? Thanks advance!

What I have tried:

I'am tryed to do with functions: sleep, tight_loop_contents and busy_wait_ms.
Updated 3-Nov-21 0:10am

There is no keypad class in the RP SDK as there is in Arduino. RP does run Arduino, but that is not your question.

So, you have to use the SDK at a lower level than you would need for Arduino:

The 4X4 matrix refers to the addressing scheme used to find a pressed key. 4 row lines are sequentially driven high so that any pressed key sends power to the column line for its position. The unique key is the two dimensional index of the row X col, say, key[row][col]. This is pretty inefficient since the matrix is sparse.

The rows are cycled at a high rate, say 1000Hz; so any key pressed is detected within 1mS. In a simple form, the columns are just GPIO inputs triggering interrupts on a positive edge. However, row circulation can be programmed in the PIO. It cycles forever driving each output high in sequence. Another PIO can be used to condition the inputs to, for example, be pressed for more than 50mS and trigger an interrupt to the processor with each qualifying key press.

Also. you can do all or part in the CPU, rows and columns can be reversed... there are probably many other permutations that are design specific.
Use a while loop. Here is example code:
while (data_count <5) //you define of you pass
    sleep_ms(1000); // time interval
	  customKey = pico_keypad_get_key(); //from your library
    if (customKey){
		  Data[data_count] = customKey; //int data_count; (nedded to use)
		  lcd.lcd_set_cursor(1, data_count);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900