Little Robot Friends
Arduino Library Reference  version 1.1
LRF.h
Go to the documentation of this file.
1 //
2 // LRF.h
3 // LittleRobotFriends
4 //
5 // Created by Mark Argo on 2014-05-20.
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 
46 #ifndef __LRF_h
47 #define __LRF_h
48 
49 #include <Arduino.h>
50 #include "LRFUtils.h"
51 #include "LRFEvents.h"
52 #include "LRFInfrared.h"
53 
54 #define LRF_FIRMWARE_MAJOR 1
55 #define LRF_FIRMWARE_MINOR 1
56 
57 #define LRF_DEBUG_CONSOLE_ENABLED 0
58 #define LRF_FORCE_HARDWARE_TEST 0
59 #define LRF_ADVANCED_HARDWARE_TEST 0
60 
61 
63 {
64 private:
65 
66 public:
67  void setup(void);
68  void loop(void);
69 
72 
91  void blink(LRFPattern pattern);
92  void blink(LRFPattern pattern, unsigned int duration);
93 
112  void say(LRFSound sound);
113 
132  void blinkAndSay(LRFPattern pattern, LRFSound sound);
133 
159  void blinkAndSay(LRFPattern pattern, LRFSound *sounds, char soundCount);
161 
164 
185  void setEventHandler(LRFEvent event, LRFEventHandler handler);
187 
188 
190 
201  void setBoredom(unsigned int timeout, unsigned char count);
202 
208  void sleep(void);
210 
211 
213 
220  LRFIRMessage readIRMessage(void);
221 
228  void sendIRMessage(LRFIRMessage message);
230 
232 
239  unsigned char readTouch(void);
240 
247  unsigned char readLight(void);
248 
255  unsigned char readMicrophone(void);
257 
259 
269  void setLeftLED(unsigned char red, unsigned char green, unsigned char blue, bool update=true);
270  void setRightLED(unsigned char red, unsigned char green, unsigned char blue, bool update=true);
271  void setBothLEDs(unsigned char red, unsigned char green, unsigned char blue, bool update=true);
273 
280  void setSpeaker(unsigned int frequency, unsigned int duration);
282 
283 };
284 
285 extern LittleRobotFriend lrf;
286 
287 #endif
unsigned char readLight(void)
Read the light sensor.
Definition: LRF.cpp:257
unsigned char readTouch(void)
Read the touch sensor.
Definition: LRF.cpp:250
void setBoredom(unsigned int timeout, unsigned char count)
Set how quickly and how often your robot gets bored.
Definition: LRF.cpp:310
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
void sleep(void)
Put the robot to sleep.
Definition: LRF.cpp:316
void setRightLED(unsigned char red, unsigned char green, unsigned char blue, bool update=true)
Set the RGB value of one or both LEDs.
Definition: LRF.cpp:283
The main class of the Little Robot Friends API.
Definition: LRF.h:62
LRFEvent
Constants for different interaction and system events.
void blink(LRFPattern pattern)
Blink a light pattern on the LED eyes.
Definition: LRF.cpp:198
void setBothLEDs(unsigned char red, unsigned char green, unsigned char blue, bool update=true)
Set the RGB value of one or both LEDs.
Definition: LRF.cpp:291
void setLeftLED(unsigned char red, unsigned char green, unsigned char blue, bool update=true)
Set the RGB value of one or both LEDs.
Definition: LRF.cpp:275
void sendIRMessage(LRFIRMessage message)
Send an IR message.
Definition: LRF.cpp:241
void say(LRFSound sound)
Speak a single sound.
Definition: LRF.cpp:208
LRFIRMessage readIRMessage(void)
Read the latest received IR message.
Definition: LRF.cpp:236
void(* LRFEventHandler)(void)
Function pointer with no parameters and no return value.
unsigned char readMicrophone(void)
Read the microphone.
Definition: LRF.cpp:264
void setup(void)
setup the LRF library
Definition: LRF.cpp:108
Collection of custom types and handy functions used throughout the LRF codebase.
void blinkAndSay(LRFPattern pattern, LRFSound sound)
Blink and speak at the same time.
Definition: LRF.cpp:213
Allows for access of pattern data as a structure or raw integer.
Definition: LRFUtils.h:156
void setEventHandler(LRFEvent event, LRFEventHandler handler)
Customize how your robot responds to particular events.
Definition: LRF.cpp:227