RC input example
To be used in autopilot applications, Navio2 needs to decode RC input. Navio2 supports both S.Bus and PPM input, which combines information about all PWM channels from the receiver in one sequence, which could be transferred over single wire. Channel values sent by remote controller will be decoded and then used for servo control.
RCInput example shows value of chosen PWM channel. You can specify the channel in source code.
Connect PPM or S.Bus output from your RC receiver to the PPM/SB input pin on Navio2. Note that your Navio2 should be powered off before connecting the receiver.
If you have not already done that, download Navio2 drivers and examples code here.
If you have not build the examples yet, perform the following commands:
To check the RC input example, you need to run this command:
Move to the folder with the source code and run the example:
sudo python RCInput.py
The program performs measurement of selected PWM channel and outputs measured values to console. The value will change if you move a stick on your RC transmitter.
For further information, see source code.
Pay attention to
rcin.init() function initialize 8 PWM channels. After that, it is possible to read value of channels 0-7 with
rcin.read() function. It takes channel number as an argument and you can change it.