Skip to content
/ iBus Public

Arduino library for decoding iBus receiver signals

License

Notifications You must be signed in to change notification settings

VICLER/iBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PROJECT_PHOTO

iBus Decoder

Arduino library for decoding Flysky iBus receiver signal

Features

  • Small size and easy to use

  • Decoding up to 14 Channels in 7ms

  • Fast PPM to PWM (0-255) and Servo (544-2400us) conversion

How to use

#include <iBus.h>   // include library
iBus(HardwareSerial, MAX_CHANNELS);   // Constructor. iBus signal should be connected to RX pin of Hardware Serial
void begin(); // initialization
void process(); // decoding process. Should be called as often as possible to update receiver data
bool available();   // returns false if not connected
uint16_t get(CHANNEL_NUMBER);   // get channel value in us
bool get(0);    // returns false if there is some corrupted data in last received packet
uint8_t getPWM(CHANNEL_NUMBER);    // get pwm (0-255) channel value
uint16_t getServo_us(CHANNEL_NUMBER);   // get Servo value (0-180)deg for using with Servo.writeMicroseconds() in range (544-2400)us

Example

#include <iBus.h>

#define MAX_CHANNELS 14

iBus receiver(Serial, MAX_CHANNELS);  // Serial on ATMega328 boards(Uno, Nano, etc.)
                                     // Serial1 on ATMega32u4 boards(Micro, Leonardo)
void setup() {
  receiver.begin();
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  receiver.process();

  digitalWrite(LED_BUILTIN, receiver.available());  // turn led on if connected

  for(byte i = 1; i <= CHANNELS; i++){  // get channel values starting from 1
    Serial.print(receiver.get(i));
    Serial.print('\t');
  }
  Serial.println(receiver.get(0));  // received packet quality. If 0 -> there are some corrupted values
  delay(10);
}

About

Arduino library for decoding iBus receiver signals

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages