Codey OnlineArduino & ESP32 component library › Drukknop
Drukknop
Input & buttons

Drukknop

Knop of button. Kan gebruikt worden voor pulse maar ook voor self-lock.

Width: 14.7 mm

Pinout — Drukknop

Pin Signal Description
COM COM
NO Normally Open

Example wiring diagram — Drukknop

From To Wire
board:D2 x1:COM green
board:GND x1:NO black

Example Arduino code — Drukknop

This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.

const int buttonPin = 2;

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("Drukknop example started. Press the button to connect the input to GND.");
}

void loop() {
  int buttonState = digitalRead(buttonPin);

  if (buttonState == LOW) {
    Serial.println("Button pressed");
  } else {
    Serial.println("Button released");
  }

  delay(200);
}

Related components

HX711 Load Cell Amplifier

HX711 Load Cell Amplifier

Keypad 4x3

Keypad 4x3

Tactile switch

Tactile switch

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free