Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

abobija/piezo32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

piezo32

Piezo buzzer Lua [NodeMCU] library

Demo

Piezo buzzer music - ESP32 - piezo32.lua

Usage

local piezo = require('piezo32')({
    gpio = 13
})

Example 1

Play sound at 1kHz for 10 times with play duration of 100ms and rest duration of 100ms as well

piezo.play({
	freq = 1000,
	play_duration = 100,
	pause_duration = 100,
	times = 10
})

Example 2

Two beeps - success sound

piezo.success()

Example 3

Low frequency error sound

piezo.error()

Example 4

Jingle Bells

piezo.play_music('E1E1E2E1E1E2E1G1C1D1E4F1F1F1F1F1E1E1E1E1D1D1E1D2G2')

Example 5

Mary Had a Little Lamb

piezo.play_music('B1A1G1A1B1B1B2A1A1A2B1B1B2B1A1G1A1B1B1B2A1A1B1A1G2G2')

Example 6

Twinkle Twinkle Little Star

piezo.play_music('C1C1G1G1A1A1G2F1F1E1E1D1D1C2')

Dependencies

Project depends on the following NodeMCU modules:

  • tmr
  • ledc

Releases

No releases published

Packages

No packages published

Languages