Little Robot Friends
Arduino Library Reference  version 1.1
MyLRF02_Say.cpp
1 //
2 // MyLRF02-Say.cpp
3 // LittleRobotFriends
4 //
5 // Created by Mark Argo on 2014-06-11.
6 // Copyright (c) 2014 Aesthetec Studio Inc. All rights reserved.
7 //
8 
9 /*
10  THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT ANY REPRESENTATIONS, CONDITIONS,
11  AND/OR WARRANTIES OF ANY KIND. WITHOUT LIMITATION, AESTHETEC STUDIO AND ITS
12  AFFILIATES, LICENSORS, SUPPLIERS, CONTRIBUTORS, SUBCONTRACTORS, DISTRIBUTORS
13  AND ALL CONTRIBUTORS DISCLAIM ANY EXPRESS OR IMPLIED REPRESENTATIONS,
14  CONDITIONS, OR WARRANTIES OF MERCHANTABILITY, MERCHANTABLE QUALITY, SATISFACTORY
15  QUALITY, NON-INFRINGEMENT, TITLE, DURABILITY, OR FITNESS FOR A PARTICULAR
16  PURPOSE, WHETHER ARISING BY STATUTE, COURSE OF DEALING, USAGE OF TRADE, OR
17  OTHERWISE. EXCEPT AS OTHERWISE PROVIDED IN THIS AGREEMENT, YOU SHALL BEAR
18  THE ENTIRE RISK FOR ANY USE OR ANY OTHER EXPLOITATION MADE BY YOU OF ANY
19  RIGHTS IN THE COVERED SOFTWARE.
20 
21  Additional copyright information found at http://littlerobotfriends.com/legal/
22 */
23 
24 //
25 
26 /*
27 
28  Tutorial #2 - Custom Sound
29 
30  This sketch shows you how to create and run a custom sound on your robot.
31 
32  Goals:
33  - Make a custom sound
34  - Play around with the values to make a short and a long sound
35  - Play around with the values to make a low and a high-pitched sound
36 
37  */
38 
39 #include "LRF.h"
40 
41 // Create a sound for the speaker
42 LRFSound mySound = {
43  LRFNote_D, // note
44  LRFOctave_6, // octave
45  LRFIntonation_Falling, // intonation (see LRFUtils.h for more info)
46  LRFDuration_Long, // note length
47  LRFDuration_None // pause length (after note has played)
48 };
49 
50 // ------------------ everything below this point runs the program --------------------
51 
52 void setup(void) // Arduino setup routine that gets called ONCE when the robot turns on
53 {
54  lrf.setup(); // lrf library should be set up before anything else
55  delay(1000);
56 
57  lrf.say(mySound); // let's try saying a sound
58  delay(1000);
59 }
60 
61 void loop(void) // Arduino loop routine that gets called OVER AND OVER while the robot runs
62 {
63  lrf.loop(); // run the lrf library
64 
65  // any other functions put in here might cause the lrf to behave strange (no delays plz!)
66 }
Falling tone (sad or upset)
Definition: LRFUtils.h:221
high octave
Definition: LRFUtils.h:205
void loop(void)
run the LRF library loop
Definition: LRF.cpp:175
Allows for access of sound data as a structure or raw integer.
Definition: LRFUtils.h:307
This is the core API class for access LRF library functions.
void say(LRFSound sound)
Speak a single sound.
Definition: LRF.cpp:208
No duration (0 ms)
Definition: LRFUtils.h:236
void setup(void)
setup the LRF library
Definition: LRF.cpp:108
Base * 16 (whole note)
Definition: LRFUtils.h:241
D (73hz)
Definition: LRFUtils.h:181