Arduino Library for reading rc reciver values
Open the arduino library manager and search for RC_Receiver created by Nils Lahaye and hit install
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
Clique the code button Then download as zip Then in the arduino IDE install the zip library See arduino official guide
#include <RC_Receiver.h>
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 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);
}
getRaw(int ch) will return the raw value form the controller
The ch
is the channel number
Serial.print(receiver.getRaw(int ch));
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));