Sound

From Pinguino
Jump to: navigation, search

Name

Sound

Description

Play notes using pwm.

Since Beta 9.5

Syntax

Sound(u8 pin, u8 note, u16 duration, u8 vol);

  • @param pin: pin number where buzzer is connected (11 or 12)

Tone and Sound use PWM, the speaker must be connected to a PWM pin.

 Pinguino x5(k)50    : 11, 12          (CCP1, CCP2)
 Pinguino 47J53      : 4, 5, 6, 7, 17  (CCP4, CCP5, CCP6, CCP7, CCP8)
 PIC32 Olimex Micro  : 10, 11, 12, 13  (OC2, OC3, OC4, OC5)
 Other chips are unknown
  • @param note: Note to Play

Romance Notes {DO,DOd,RE,REd,MI,FA,FAd,SOL,SOLd,LA,LAd,SI,DO_}

English Notes {C,Cs,D,Ds,E,F,Fs,G,Gs,A,As,B,C_}

  • @param duration: Duration in ms
  • @param vol: Volume from 0 to 10

Example

Sound(11, DO, 250, 10);

Play a DO during 250ms, volume is max.

Buzzer must be connected on pin 11 (CCP2).

Bugs

See Also

Sound Library, 
sound
tone
play
noTone

Comments