Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Arduino make a Sound

Arduino make a Sound

Scheduled Pinned Locked Moved Development
2 Posts 2 Posters 754 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • EuromirE Offline
    EuromirE Offline
    Euromir
    wrote on last edited by
    #1

    Forgive the newbie super simple question......

    So im using the door/window switch sketch with a Doorbell, mostly to send push notifications to phone etc. So far so good on my bread-boarding prototype.

    Now i want to add a sounder, either tiny speaker or piezo so as it makes a noise like a ordinary doorbell, mainly so callers realise its working, but also for anyone to hear if not got push notification etc.

    The arduino will when fully installed will be run off mains power so not too worried about current draw, just need some simple code and how to edit it into the switch sketch, sorry learning arduino as i go, i know its basic. I googled some basic Tone code to make a sound, but getting confused on how to add it into existing code without breaking switch.

    Boots33B 1 Reply Last reply
    0
    • EuromirE Euromir

      Forgive the newbie super simple question......

      So im using the door/window switch sketch with a Doorbell, mostly to send push notifications to phone etc. So far so good on my bread-boarding prototype.

      Now i want to add a sounder, either tiny speaker or piezo so as it makes a noise like a ordinary doorbell, mainly so callers realise its working, but also for anyone to hear if not got push notification etc.

      The arduino will when fully installed will be run off mains power so not too worried about current draw, just need some simple code and how to edit it into the switch sketch, sorry learning arduino as i go, i know its basic. I googled some basic Tone code to make a sound, but getting confused on how to add it into existing code without breaking switch.

      Boots33B Offline
      Boots33B Offline
      Boots33
      Hero Member
      wrote on last edited by
      #2

      @Euromir The tone function will do that. I have used it in this project to register when the touch buttons are pressed. I have used a small piezo buzzer but i believe a speaker can also be used.

      It is very easy to use, just three parameters pinnumber,frequency,duration

      So to play a tone on pin 7 at 1200Hz for 60ms you would use

      tone(7, 1200, 60);
      
      
      1 Reply Last reply
      1
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      12

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular