{"id":8,"date":"2026-05-07T07:04:02","date_gmt":"2026-05-07T07:04:02","guid":{"rendered":"https:\/\/thomasvangompel.com\/?p=8"},"modified":"2026-05-08T07:30:40","modified_gmt":"2026-05-08T07:30:40","slug":"arduino-uno-beginner-push-button-and-buzzer-project","status":"publish","type":"post","link":"https:\/\/thomasvangompel.com\/index.php\/2026\/05\/07\/arduino-uno-beginner-push-button-and-buzzer-project\/","title":{"rendered":"Arduino UNO (Beginner) Push Button and Buzzer Project"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"819\" src=\"https:\/\/thomasvangompel.com\/wp-content\/uploads\/2026\/05\/pushbutton-3-1024x819.png\" alt=\"\" class=\"wp-image-17\" style=\"aspect-ratio:1.2503488696622942;width:536px;height:auto\" srcset=\"https:\/\/thomasvangompel.com\/wp-content\/uploads\/2026\/05\/pushbutton-3-1024x819.png 1024w, https:\/\/thomasvangompel.com\/wp-content\/uploads\/2026\/05\/pushbutton-3-300x240.png 300w, https:\/\/thomasvangompel.com\/wp-content\/uploads\/2026\/05\/pushbutton-3-768x615.png 768w, https:\/\/thomasvangompel.com\/wp-content\/uploads\/2026\/05\/pushbutton-3.png 1402w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Instructions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"> One of the easiest and most useful beginner projects is connecting a push button and a buzzer. .<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When the button is pressed, the buzzer will produce a sound. When the button is released, the sound stops. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>component<\/strong><\/td><td><strong>connection<\/strong><\/td><\/tr><tr><td>Push button<\/td><td>One side to GND<\/td><\/tr><tr><td>Push button<\/td><td>Other side to pin 2<\/td><\/tr><tr><td>Buzzer (+)<\/td><td>Pin 8<\/td><\/tr><tr><td>Buzzer (-)<\/td><td>GND<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-white-color has-luminous-vivid-amber-background-color has-text-color has-background has-link-color wp-elements-b4095f01e1ad61b8a026554f710e74df wp-block-paragraph\">The exact position on the breadboard does not matter. For example, the push button can be placed between rows D5 and D7, while the buzzer can be connected around rows D20 and D23, as long as the electrical connections are correct.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const int buttonPin = 2;\nconst int buzzerPin = 8;\n\nvoid setup() {\n  pinMode(buttonPin, INPUT_PULLUP);\n  pinMode(buzzerPin, OUTPUT);\n}\n\nvoid loop() {\n  int buttonState = digitalRead(buttonPin);\n\n  \/\/ Button pressed\n  if (buttonState == LOW) {\n    tone(buzzerPin, 1000);\n  } else {\n    noTone(buzzerPin);\n  }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/10hasSbAAew?si=Et4IqyBrNLxxy-7D\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Instructions One of the easiest and most useful beginner projects is connecting a push button and a buzzer. . When the button is pressed, the buzzer will produce a sound. When the button is released, the sound stops. component connection Push button One side to GND Push button Other side to pin 2 Buzzer (+) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":16,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,4,5],"class_list":["post-8","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","tag-arduino","tag-buzzer","tag-push-button"],"_links":{"self":[{"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":5,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":18,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/posts\/8\/revisions\/18"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/media\/16"}],"wp:attachment":[{"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomasvangompel.com\/index.php\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}