![OPEN-SMART Rich UNO R3 Скачать руководство пользователя страница 59](http://html1.mh-extra.com/html/open-smart/rich-uno-r3/rich-uno-r3_user-manual_1639721059.webp)
OPEN-SMART Email:
- 59 -
2)
Other header files
In lesson 11 we use IR remote, so it should include their header files to control remote more
easily.
So you should add:
#include "RichUNOIRremote.h"
3) Define class object
We have defined the IR remote 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:
IRrecv IR(2);//define an IR receiver object to get the key code, the receiver pin connect to D2 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
* 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;
* IR.keycode // this will return the value of key code you just press
* IR.usercode// this will return the value of user code you just press
* Serial.begin(9600);//set serial output baud rate is 9600bps, so your serial monitor should be the
same, and should be called at the setup() function.
* Serial.print("key code is ");//print the string “key code is” on the serial monitor
* Serial.println(IR.keycode,HEX); // print the string on the serial monitor and line feed