Documentation
¶
Overview ¶
Package activebuzzer is a driver allowing to control an avtive buzzer from GPIO pin
Example ¶
err := rpio.Open() if err != nil { fmt.Println("impossible to init gpio") os.Exit(1) } defer rpio.Close() // buzzer connected to GPIO pin 17 buzzer := activebuzzer.NewActiveBuzzer(17) buzzer.Tone() time.Sleep(3 * time.Second) buzzer.StopTone()
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveBuzzer ¶
type ActiveBuzzer struct {
// contains filtered or unexported fields
}
ActiveBuzzer represent an active buzzer
func NewActiveBuzzer ¶
func NewActiveBuzzer(pinID int) *ActiveBuzzer
NewActiveBuzzer creates a new ActiveBuzzer instance
Example ¶
err := rpio.Open() if err != nil { fmt.Println("impossible to init gpio") os.Exit(1) } defer rpio.Close() // buzzer connected to GPIO pin 17 buzzer := activebuzzer.NewActiveBuzzer(17) buzzer.Tone()
func (*ActiveBuzzer) StopTone ¶
func (buzzer *ActiveBuzzer) StopTone()
StopTone stops the buzzer tone
Example ¶
err := rpio.Open() if err != nil { fmt.Println("impossible to init gpio") os.Exit(1) } defer rpio.Close() // buzzer connected to GPIO pin 17 buzzer := activebuzzer.NewActiveBuzzer(17) buzzer.Tone() buzzer.StopTone()
func (*ActiveBuzzer) ToggleTone ¶
func (buzzer *ActiveBuzzer) ToggleTone()
ToggleTone toggle the buzzer tone Tone if stopped and stopped is toned
Example ¶
err := rpio.Open() if err != nil { fmt.Println("impossible to init gpio") os.Exit(1) } defer rpio.Close() // buzzer connected to GPIO pin 17 buzzer := activebuzzer.NewActiveBuzzer(17) for i := 0; i < 10; i++ { buzzer.ToggleTone() }
func (*ActiveBuzzer) Tone ¶
func (buzzer *ActiveBuzzer) Tone()
Tone activate the buzzer tone
Example ¶
err := rpio.Open() if err != nil { fmt.Println("impossible to init gpio") os.Exit(1) } defer rpio.Close() // buzzer connected to GPIO pin 17 buzzer := activebuzzer.NewActiveBuzzer(17) buzzer.Tone()
Click to show internal directories.
Click to hide internal directories.