![OPEN-SMART Rich UNO R3 Скачать руководство пользователя страница 65](http://html1.mh-extra.com/html/open-smart/rich-uno-r3/rich-uno-r3_user-manual_1639721065.webp)
OPEN-SMART Email:
- 65 -
17.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.playWithVolume(int8_t index, int8_t volume);//play the song according to the physical
index of song in the TF card and the volume set
For example:
mp3. playWithVolume(1, 20);//play the first song with volume 20 (max is 30)