![OPEN-SMART Rich UNO R3 User Manual Download Page 97](http://html1.mh-extra.com/html/open-smart/rich-uno-r3/rich-uno-r3_user-manual_1639721097.webp)
OPEN-SMART Email:
- 97 -
26.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, 4-digit display, RTC and touch sensor, so it should include their header
files to control display more easily.
So you should add:
#include "RichUNOMP3.h"
#include "RichUNOTouchSensor.h"
#include "RichUNOTM1637.h"
#include "RichUNODS1307.h"
#include "RichUNOBuzzer.h"
#include "RichUNOLM75.h"
#include "RichUNOKnob.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
LM75 temper; // initialize an LM75 object "temper" for temperature
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
* knob.getAngle();//read the angle of the knob, the range of angle is 0~280 degrees
* updateVolume();//used to update volume according to the angle of the knob
* touch.get(); // return is the touch area corresponding Arduino pin number, if not then return -1