Skip to content

Nilon123456789/Receiver

Repository files navigation

Receiver Library

Check Build

Arduino Library for reading rc reciver values

Installing the Library

Arduino Library manager

Open the arduino library manager and search for RC_Receiver created by Nils Lahaye and hit install

Release

Go to the release page to get the latest satable release. Then download the source.zip Then in the arduino IDE install the zip library See arduino official guide

Form repo

Clique the code button Then download as zip Then in the arduino IDE install the zip library See arduino official guide

How to use

Import the library

#include <RC_Receiver.h>

Initalise the receiver

you can use fewer channels but the max is 8 per instance

RC_Receiver receiver('ch1 pin','ch2 pin','ch3 pin','ch4 pin','ch5 pin','ch6 pin','ch7 pin','ch8 pin');

Set custom Min and Max value for the mapping

Set custom values for the range of the controller. The value can be found by using the RC_raw example and moving the joystick to there min and max positon and reading the value Inverting the min and max will reverse the values

int minMax[8][2] = 
{
	{2020,1010}, 
	{1010,2020}, 
	{1010,2020}, 
	{1010,2020}, 
	{1010,2020}, 
	{1010,2020}, 
	{1010,2020}, 
	{1010,2020}
};

void setup() {
	receiver.setMinMax(minMax);
}

Get raw values

getRaw(int ch) will return the raw value form the controller The ch is the channel number

Serial.print(receiver.getRaw(int ch));

Get mapped values

getMap(int ch) will return the mapped value (0 to 100) form the controller The ch is the channel number

Serial.print(receiver.getMap(int ch));