confused about example code: Lesson2 exercise 1 of nRF Connect SDK Fundamentals

hello community

I`m a beginner, try to test the Lesson2 exercise 1 code of nRF Connect SDK Fundamentals, it´s about LED and buttons.

Thingy53 I`m using, this is the schematic, theoritcally, if button(SW3) is pressed, it´s connected to ground, namely, logic 0. 

button in the code, I actually get logic 1, when the button is pressed, this confuses me, why???

	while (1) {
		/* STEP 6.1 - Read the status of the button and store it */
        bool val = gpio_pin_get_dt(&button);
		printk("button:%d",val);
		/* STEP 6.2 - Update the LED to the status of the button */
        gpio_pin_set_dt(&led,val);

        k_msleep(SLEEP_TIME_MS); // Put the main thread to sleep for 100ms for power optimization
	}


Related