38 lines
1011 B
C
38 lines
1011 B
C
#include <stdio.h>
|
|
#include "pico/stdlib.h"
|
|
#include "hardware/gpio.h"
|
|
#include "hardware/irq.h"
|
|
|
|
#define BUTTON_PIN_ROW_1 16
|
|
#define BUTTON_PIN_COLUMN_1 18
|
|
#define LED_PIN 25
|
|
|
|
void button_callback(uint pin);
|
|
|
|
int main() {
|
|
stdio_init_all();
|
|
gpio_init(BUTTON_PIN_ROW_1);
|
|
gpio_init(BUTTON_PIN_COLUMN_1);
|
|
gpio_set_dir(BUTTON_PIN_COLUMN_1, GPIO_OUT);
|
|
gpio_set_dir(BUTTON_PIN_ROW_1, GPIO_IN);
|
|
gpio_pull_up(BUTTON_PIN_ROW_1);
|
|
gpio_pull_up(BUTTON_PIN_ROW_1);
|
|
gpio_init(LED_PIN);
|
|
gpio_set_dir(LED_PIN, GPIO_OUT);
|
|
while (true) {
|
|
if (!gpio_get(BUTTON_PIN_ROW_1)) {
|
|
gpio_put(LED_PIN, 0);
|
|
// printf("ROW: %i\n", gpio_get(BUTTON_PIN_ROW_1));
|
|
// printf("COLUMN: %i\n", gpio_get(BUTTON_PIN_COLUMN_1));
|
|
} else {
|
|
gpio_put(LED_PIN, 1);
|
|
// printf("ROW: %i\n", gpio_get(BUTTON_PIN_ROW_1));
|
|
// printf("COLUMN: %i\n", gpio_get(BUTTON_PIN_COLUMN_1));
|
|
}
|
|
}
|
|
}
|
|
|
|
void button_callback(uint pin){
|
|
|
|
}
|