# 1.5 Doorbell Today we will make a doorbell, click the bell sprite on the stage, the buzzer will sound; click again, the buzzer will stop sounding. ![](./img/1.5/1.5_bell_header.gif) ## Required Components ![](./img/1.5/1.5_list.png) ## Build the Circuit ![](./img/1.5/1.5_fritzing.png) ## Load the Code and See What Happens Load the code file (`1.5_doorbell.sb3`) to Scratch 3.上 Click on the green flag on the stage. When we click on the Button 3 sprite, it will turn blue and then the buzzer will sound; when we click again, the **Button3** sprite reverts to gray and the buzzer stops sounding. ## Tips on Sprite Delete the default sprite, then choose the **Bell** sprite. ![](./img/1.5/1.5_sprite.png) Duplicate two bell characters ![](./img/1.5/1.5_sprite1.png) Change the color of the bell2 sprite. Display the color when the doorbell is clicked ![](./img/1.5/1.5_sprite2.png) Adjust the direction of the bell sprites for bell2 and bell3 sprite. ![](./img/1.5/1.5_sprite3.png) ## Tips on Codes This block allows you to switch the sprite’s costume. [![img](./img/1.5/1.5_code.png)](https://docs.sunfounder.com/projects/davinci-kit/en/latest/_images/1.13_buzzer4.png) Set gpio17 to low to make the buzzer sound; set it to high and the buzzer will not sound. [![img](./img/1.5/1.5_code1.png)](https://docs.sunfounder.com/projects/davinci-kit/en/latest/_images/1.13_buzzer5.png) When the bell sprite is clicked, the program outputs a high-low voltage cycle with a period of 0.1 seconds to the GPIO pin. This drives a buzzer to produce a sound. At the same time, the program alternates between showing the bell2 sprite and the bell3 sprite. This creates a visual effect that accompanies the buzzer sound. ![img](./img/1.5/1.5_code2.png) In summary, the program creates a doorbell-like experience, where clicking the bell sprite triggers both an audible and visual response. The GPIO output controls a buzzer to make a ringing sound, while the costume changes of the bell sprite provide visual feedback to the user. This Scratch program demonstrates the use of input/output control, timing, and sprite animation to create a simple but interactive electronics project. It's a great example of how Scratch can be used for basic hardware interfacing and multimedia projects.