hArduino-1.2: Control your Arduino board from Haskell.
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Hardware.Arduino.Parts.Piezo

Description

Abstractions for piezo speakers.

Synopsis

Declaring a piezo speaker

data Piezo Source #

A piezo speaker. Note that this type is abstract, use speaker to create an instance.

speaker Source #

Arguments

:: Int

Tempo. Higher numbers mean faster melodies; in general.

-> Pin

Pin controlling the piezo. Should be a pin that supports PWM mode.

Create a piezo speaker instance.

Notes you can play, and durations

data Note Source #

Musical notes, notes around middle-C

Constructors

A
B
C
D
E
F
G
R

Instances

Instances details
Instance details

Defined in System.Hardware.Arduino.Parts.Piezo

Methods

showsPrec :: Int -> Note -> ShowS #

show :: Note -> String #

showList :: [Note] -> ShowS #

Instance details

Defined in System.Hardware.Arduino.Parts.Piezo

Methods

(==) :: Note -> Note -> Bool #

(/=) :: Note -> Note -> Bool #

data Duration Source #

Beat counts

Constructors

Instances

Instances details
Instance details

Defined in System.Hardware.Arduino.Parts.Piezo

Instance details

Defined in System.Hardware.Arduino.Parts.Piezo

Methods

(==) :: Duration -> Duration -> Bool #

(/=) :: Duration -> Duration -> Bool #

Playing a note, rest, or silencing

playNote :: Piezo -> (Note, Duration) -> Arduino () Source #

Play the given note for the duration

rest :: Piezo -> Duration -> Arduino () Source #

Rest for a given duration:

silence :: Piezo -> Arduino () Source #

Turn the speaker off

Play a sequence of notes:

playNotes :: Piezo -> [(Note, Duration)] -> Arduino () Source #

Play a sequence of notes with given durations:

AltStyle によって変換されたページ (->オリジナル) /