hArduino-0.8: Control your Arduino board from Haskell.

Stabilityexperimental
Maintainererkokl@gmail.com
Safe HaskellNone

System.Hardware.Arduino.Parts.Piezo

Contents

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.

speakerSource

Arguments

:: Int

Tempo. Higher numbers mean faster melodies; in general.

-> Pin

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

-> Arduino Piezo 

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

data Duration Source

Beat counts

Constructors

Whole 
Half 
Quarter 
Eight 

Instances

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: