hArduino-1.1: Control your Arduino board from Haskell.

Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

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.

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.

-> 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 

data Duration Source

Beat counts

Constructors

Whole 
Half 
Quarter 
Eight 

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: