0PricingLogin
Arduino & IoT Academy · Lesson

INPUT vs INPUT_PULLUP

Why a floating pin lies and how pull-ups fix it.

Pins Can Listen Too

So far your pins pushed signals out. Now you'll make a pin listen instead, so your board can sense a button and react to it.

Set a Pin as INPUT

To read a button, you first tell a pin it should receive a signal. You do that by setting its mode to INPUT inside setup().

void setup() {
  pinMode(2, INPUT);
}

All lessons in this course

  1. INPUT vs INPUT_PULLUP
  2. Reading a Button State
  3. if/else: LED Follows the Button
  4. Wire a Button on a Breadboard
← Back to Arduino & IoT Academy