![OPEN-SMART Rich UNO R3 Скачать руководство пользователя страница 62](http://html1.mh-extra.com/html/open-smart/rich-uno-r3/rich-uno-r3_user-manual_1639721062.webp)
OPEN-SMART Email:
- 62 -
16.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 4-digit display, IR remote and buzzer, so it should include their header files
to control display more easily.
So you should add:
#include "RichUNOTM1637.h"
#include "RichUNOIRremote.h"
#include "RichUNOBuzzer.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:
TM1637 disp(10,11);
//define a TM1637 object, and display connect to D10 / D11 of Rich UNO
R3 board
Buzzer buzzer(9);//define Buzzer object, it connects to D9 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
* buzzer.on();//turn on the buzzer
* buzzer.off();//turn off the buzzer
* IR.enableIRIn(); // Start the receiver
* IR.decode();//if no result, it return 0, otherwise it return 1; .
* IR.resume(); // so that it can receive the next value
* IR.isReleased();//if the button is not released yet, it return 1; otherwise it return 0;
* disp.init(); // initialization
You should write it in the setup function initialize it.
* disp.display(int Decimal); // display range: -999 ~ 9999