![OPEN-SMART Rich UNO R3 Скачать руководство пользователя страница 68](http://html1.mh-extra.com/html/open-smart/rich-uno-r3/rich-uno-r3_user-manual_1639721068.webp)
OPEN-SMART Email:
- 68 -
18.3 Learn the functions
1)
You can find that at the beginning of all lessons code is
#include <Wire.h>
#include <SoftwareSerial.h>
Because the RichUNO library files use Wire.h and SoftwareSerial.h which is not in the RichUNO
directory, if the example code wants to use RichUNO library, it should add those two line.
2)
Other header files
In this lesson we use MP3, so it should include their header files to control MP3 more easily.
So you should add:
#include "RichUNOMP3.h"
3) Define class object
We have defined the class in the RichUNO library, and at any time you should define a object
before you use it, and some object has parameter.
For example:
MP3 mp3(7, 8);//define the MP3 object and connect to D7/D8 of Rich UNO R3
4) Two necessary functions
Each example code should inclue the two necessary functions:
void setup(){ }
void loop(){}
Usually we write initialization code in setup function, and then write the code what you want the
board to do in loop function which runs cyclically.
5) Functions
mp3.playWithFileName(int8_t directory, int8_t file);
//play a song according to the folder name and
prefix of its file name
//directory (folder name) must be 01 02 03...09 10...99
//prefix of file name must be 001...009 010...099
mp3.setVolume(int8_t vol);//vol is 0~0x1e, 30 adjustable level