Giter Club home page Giter Club logo

vjoyserialfeeder's Introduction

VJoySerialFeeder

What is it?

A program for feeding data from a serial port to a virtual joystick. Currently these virtual joysticks are supported:

The data coming through the serial port should be structured in a specific way in order for the feeder to recognize it. Currently several protocols are supported:

  • IBUS - used by FlySky radio controllers.
  • SBUS - used by FrSky, Futaba radio controllers.
  • DSM - used by Spektrum radio controllers.
  • MultiWii Serial Protocol - used by RC Flight Controllers running MultiWii, CleanFlight, BetaFlight, iNav, etc.
  • KISS serial protocol - used by KISS RC Flight Controllers.
  • PPM (converted to IBUS) - see Use case 8.
  • CrossFire - thanks to @CapnBry #49
  • DJI Phantom 3 Controller - thanks to @cmyip #52

After data is received it can be mapped to any virtual joystick axis or button in very flexible and configurable way.

Screenshot

Use cases

  1. Use Arduino to read data from any device and send it to your PC - basic sketch in the Arduino directory. See example on using old RC controller for simulators.
  2. Read RC controller (FlySky) directly from any IBUS capable receiver. How-to.
  3. Read RC controller (FrSky, Futaba, etc.) directly from any SBUS receiver. How-to.
  4. Read RC controller (Spektrum) from a DSM receiver. How-to.
  5. Use MultiWii compatible Flight Controller (MultiWii, CleanFlight, BetaFlight, etc.). You can use your actual RC model. How-to.
  6. Use KISS Flight Controller. You can use your actual RC model. It is pretty much the same as MultiWii, only you have to select KISS for protocol.
  7. Use as general virtual joystick feeder. Although the program has the word "Serial" in its name, it is not strictly necessary to feed the virtual joystick from the serial port. You can interact with vJoySerialFeeder in different ways and feed your own data to the virtual joystick or you can get the serial data and use it for your own purposes other than controlling a virtual joystick. How-to.
  8. Feed over network. You can use pairs of virtual serial ports provided by com0com and com2tcp for the TCP/IP transport. Another option is HW VSP3 which combines the virtual serial port and the TCP/IP transport but the free version allows only one COM port.
  9. If you have older RC receiver that only supports PPM you can use Arduino and this sketch to convert PPM -> IBUS. Thanks to wdcossey!
  10. If you have older RC receiver that only supports PWM you can use Arduino and this sketch to convert PWM -> IBUS.

How to get it?

You can download binaries from the releases section or you can build it yourself. Development is done with SharpDevelop 4.4

How to use it?

Check out the Manual.

Like it?

If this software brought a smile on your face, you may shine back if you feel like it: Donate
Thank you!!!

vjoyserialfeeder's People

Contributors

capnbry avatar cleric-k avatar cmyip avatar fape avatar jpasichnyk avatar qba667 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vjoyserialfeeder's Issues

FlySky Fs-ia6 receiver

Hi,

It's not an issue, just FYI. You can make another protocol, e.g. Ibus(Ia6)

I have a spare FS-ia6. I wanted to us it for the simulator. I made a mod regarding to this: http://endoflifecycle.blogspot.com/2016/10/flysky-ia6-ibus-setup.html

The iBus protocol of this receiver is a bit different as of the ia6b. The differences are detailed here: https://www.rcgroups.com/forums/showthread.php?2711184-Serial-output-from-FS-IA6-%28Semi-I-BUS%29

I made some modification to IbusReader.cs, and its working now with my FlySky FS-i6.

line 69-70
--- // check length byte
--- var len = Buffer[0];
+++ // packet size is 31
+++ var len = 0x1F;

line 76
--- chksum = (UInt16)(0xFFFF - len);
+++ chksum = (UInt16)(0x0000);

line 88
--- chksum -= Buffer[idx++];
+++ chksum += (UInt16)(Buffer[idx++] | (Buffer[idx++] << 8));
line 98-99
--- if(Buffer[data_start] == PROTOCOL_COMMAND40) {
--- // Execute command - we only know command 0x40

line 101
--- data_start++; // skip command byte

line 109
--- }

Wont Run on MS Surface Pro 2

Hi I am having trouble with your serialfeeder on my Surface Pro 2 Complete new install of windows 10 pro and the main exe file vjoyserialfeeder.exe wont run at all, no errors just wont open.
How ever it works fine on my desktop pc with windows 10 pro.
Tried everything I can think of firewall, virus scan disable, compatibility troubleshoot, admin and nothing. Am I missing some core Microsoft components possibly?

Any insight would be greatly appreciated?
Thankyou

Have a button to open Gamepad settings window open

It will be helpful to have a button below or above to open this window (shown in the image)
gamepad settings

You can use this code:

System.Diagnostics.Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL joy.cpl");

Serial port disconnecting when turning on FS-i6X controller

Hello,

I've recently discovered the Drone mesh tutorial on youtube and thought I'd give it a try. I'm a noob in drones / rf receivers / rf protocols so please keep that in mind as this issue might not even be a real one, but since I haven't found an answer to it on older issues and the tutorial doesn't cover it, here it goes.

I have been able to open the vJoySerialFeeder and open the COM port connected to my Arduino (using an UNO R3) and it does connect to my FS-X6B, but as soon as I turn on the controller, the program disconnects the port and displays an error message. I'm not sure if the problem is with the model of arduino used, or some advanced configuration in the controller, but any help would be greatly appreciated.

Thanks in advance.

Failsafe issue (other threads don't have the solution :( )

Hi,
I'm using the latest serialfeeder, and I'm sending ibus data over USB.
(Wemos D1 mini.)
When checking in serial monitor I get :
12 40 1F 02 1F 02 1F 02 1F 02 1F 02 1F 02 1F 02 1F 02 A5 FE
I'm sending 8 channels, all of them fixed value 543.
I use a fixed value to make sure it's not a problem with the A/D code.
When I did use the complete code, it showed the measured data.

vjoySerialFeeder states: Connected but ALWAYS with failsafe. Sometimes waiting for serial data, sometimed serial data read timeout.
Also, frefresh interval is always around 100ms, even when I change the interval in my code. Even with 1s! interval in the code,
the status claims a 100ms refresh!

This is my code:
(using the ibus.cpp and ibus.h from the original.)
Wemos only has 1 analog port, I use a 16ch. analog multiplexer to read all values (even switches...)
Values are read correctly (I verified)


#include <Arduino.h>
#include "ibus.h"

#define UPDATE_INTERVAL 10 // milliseconds
#define MAX_CHANNEL 8 // Number of TX channels
#define NUM_CHANNEL (MAX_CHANNEL - 1)

int DataBlock[MAX_CHANNEL];
IBus ibus(NUM_CHANNEL);

void setChannel(int Ch)
{
digitalWrite(D1, Ch & 0x01);
digitalWrite(D2, Ch & 0x02);
digitalWrite(D3, Ch & 0x04);
digitalWrite(D4, Ch & 0x08);
}

void readInputs(void)
{
for(int i=0; i < MAX_CHANNEL; i++)
{
setChannel(i);
digitalWrite(D5, 0);
analogRead(A0);
DataBlock[i]=analogRead(A0);
digitalWrite(D5, 1);
}
}

void transmitData(void)
{
ibus.begin();
for(int i=0; i<=NUM_CHANNEL; i++)
{
ibus.write(DataBlock[i]);
// ibus.write(543);
}
ibus.end();
}

void setup() {
// put your setup code here, to run once:
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(D3, OUTPUT);
pinMode(D4, OUTPUT);
pinMode(D5, OUTPUT);
digitalWrite(D5, 1); // LOW is analog mux enabled!!!
Serial.begin(115200);
readInputs();
}

void loop() {
unsigned long time = millis();
// put your main code here, to run repeatedly:
readInputs();
transmitData();
time = millis() - time; // time elapsed in reading the inputs
if(time < UPDATE_INTERVAL)
// sleep till it is time for the next update
delay(UPDATE_INTERVAL - time);
}

the next improvement , middle position stick on disconnect or usb unplug

would it be hard to implement a function to center stick (or idealy for the user to choice a value on each channel) on disconnect/connection lost/usb unplug/no data for X sec

i run in the case toonight where a game not seeing center stick was taking some input , but my Transmitter was far away (lazy guy here ;) ) and i could not get it to center without my transmiter.

maybe i could have cut vjoy or do something else but i think it was worth mentioning.
it would have been more user friendly if i had nothing to do to fix it
however if it is too much work i can live with it.

Aside that i am enJOYing every moment with my wireless transmitter

Using accelerometer MPU6050 as XY joy axis

Considering that the values i have are converted to 10bit signal that are the kind of signals retrivied by a analog input.and defining the 2 channels for x and y of the joystick, can i just send my sensor values on ibus.write() or i have to declare a pin for it(with is senseless cause the comunication with the sensor is i2c)?

Feature Request: Mapping POV Hat in vJoySF

I was not able to find any mention, and I think it would be very useful to be able to map inputs in vJoySF to vJoy hat switch inputs. it seems to be the one thing substantially missing in the features of the main program, unless I've overlooked some functionality

Arduino

Hello, I have a problem with the configuration. I connected to my Arduino a rotary encoder that send through serial port his position (-6 to 6). How I can use this value to move the X Axis?

Send commands

Hi, a semi-related question: is IBUS bidirectional? can I set values back in the RC?

Arduino SBUS to USB HID Joystick

Maybe it's not the right place to ask but it seems you know a lot in the field.

I wonder if it's possible to flash an Arduino board with something that takes IBUS/SBUS signal from the receiver and converts it into USB HID Joystick. So you could just plug it in and run the simulator. There is the Joystick library for Arduino and you have the Sbus_invert.ino sketch. If only we could combine them together :)

Is it theoretically possible or there are some hardware limitations or something? The demand for such board seems to be pretty high (it's a much better replacement for audio-usb converters) but I have found only two not very popular examples: one, two (in Russian).

NXT?

Would it be possible to get data from a Lego NXT Sensor (via a per USB connected nxt block) ?

PPM to IBus

Hey mate,

This is not an issue (GitHub really needs a messaging system).

Wrote this ppm-to-ibus-serial sketch, for those that don't have compatible receivers for use with vJoySerialFeeder.

not a problem with the program, but with my cable

Hello, this may sound a bit odd.

I love the vjoyserialfeeder and it's a critical component of my arduino 4 joystick game controller, and I play it daily, and share it whenever possible. There is not a problem with the app, however, i do have a problem that I wonder if the app can fix.

basically, I am always plugging and unplugging, which has resulted in a connection to usb that is a bit unstable,, just every once in a while it disconnects if I move wrong. ,, with my other game controllers, this is never an issue because I suppose the driver automatically polls to find the controller, so I never notice any disconnects. However, with my arduino controller, if I disconnect, I need to manually reconnect.

Would it be possible to have some sort of "while connected, it will always try to reconnect if there is a failure" feature? I don't know how complex this would be, however I am a bit concerned because although for my experience it would be nice,, I have been sending controllers I build (not selling, but still sharing with others) and I am a little worried that the experiences of the end users might suffer a bit if they too wear out their usb cables a bit. Particularly as I don't necessarily expect these end users to be as able to figure out all of their problems, as I am sending them with no idea how much experience they have with arduino and such apps, so far several have had none.

My complements and gratitude for the app, it is simply excellent, and because i found it, I thought my 4 joystick game controller could be possible, I owe a significant portion of my last few years to it, and virtually my entire recent gaming experience. I absolutely love it, but I have , as a result, worn out my usbs a bit,, and now I suffer from frequent loss of connection, which does always force me to manually reconnect.

Thanks!!

Pin Connection Issue

Hi. I have tried your software on arduino uno and was succesfull on axises. But i have problem on button mapping. Does we have to use pullup ressistor? Cant we use arduino's internal resistor? I think if we can do it, we can just connect the buttons between GND and digital pins without resistors. I have tried change the code but the connection between software and arduino has error after that.

[FIXED] Serial Port Read Timeout

When I plug in my FS-A8S to PC via USB to UART/Arduino nano it appears as COM port, but when I select COM port in app, it says "Connected, Failsafe (Serial Port Read Timeout)" I've tried everything I could find. LED on receiver is blinking. Plz help me with this

"Version of Driver(219) does NOT match DLL Version(218)" Error shows after a succeseful input test

After testing a code that sends a input based on a piezo press,the vJoy Serial Feeder read that input okay.
But after i disconnected it from the channels and unplug my Arduino Uno ,then pluged it again, he doesnt connect and always shows that message:
"Version of Driver(219) does NOT match DLL Version(218)"

Ps:it already happened before but then i restarted my computer and woked for 1 more time,then message appears again,and second time i restart everthing including my computer i receive that message again.

The code i submitted and worked 2 times:

`#include "ibus.h"
#define UPDATE_INTERVAL 10 // milliseconds
#define BAUD_RATE 115200

IBus ibus(1);

int lim=350;//limite do piezo pra ativar
int atraso = 43;//tempo de delay entre sons
int apertou=LOW;
int pad;

void setup()
{
Serial.begin(BAUD_RATE);
}
void loop() {

unsigned long time = millis();

pad = analogRead(A0);///salva o valor maximo obtido pelo piezo no vetor pad

if (pad > lim)
{
apertou=HIGH;
}
else
{
apertou=LOW;
}
ibus.begin();

ibus.write(apertou == HIGH ? 1023 : 0 );

ibus.end();

time = millis() - time; // time elapsed in reading the inputs
if(time < UPDATE_INTERVAL)
// sleep till it is time for the next update
delay(UPDATE_INTERVAL - time);
//Fim da comunicação

}`

Linux version only runs on Ubuntu 16.04

Hello,

First of all thank you very much for all your efforts. I am using this tool on Windows without a problem. I am using it for connecting my Radiolink AT9S transmitter to simulators using SBUS on the receiver and Arduino UNO (with the sbus_invert sketch).

My problem is, on Linux I was only able to run it on Ubuntu 16.04. Later versions did not work. I first tried Manjaro and assumed it is a problem about Manjaro. Then I made a fresh insatll of Ubuntu 20.04 and it did not work. Looking at the release date, I assumed you tried it on Ubuntu 18.04 or 16.04 and tried to get it running on both with fresh installs and the same procedure/same Arduino. Only 16.04 worked.

I guess something changed after the Ubuntu version 16.04.

Do you have any idea about this?

Thanks and regards

Lag

Hi Clerik-K

I´m using latest version 2.1.9 vJoy Shaul with 1.4 vJoyserialfeeder Cleric.
I´m experiencing total 85ms lag in my system.
There is maybe 50ms more than it should be.

My setup:

Turnigy Evo > Receiver ia6c (+/- 17ms )

Arduino nano (IBUS) > vjoyserialfeeder ( 8ms )

vJoy > Liftoff ( Fpv simulator racing game ) ( Total 85ms )

From Turnigy Evo > liftoff = 85ms lag.
Or
From Turnigy Evo > vjoyserialfeeder or (Chanel monitor) = +/- 80ms

I tested my 1ms mouse G903 and its real 1ms lag.

I need help, can you help me debug this lag?
Thanks for the great app really amazing ;)

Looking for some help

Hi just wondering your able to give me any help with the feeder app. Ive installed vjoy and when i go to open the com port with the feeder app it says failed to open port. Ive made sure my instance of betaflight is closed on my pc aswell. When i do open betaflight the port connects fine to it and i can see my reciever working etc.

rfcomm bluetooth serial ports in Linux

Hi, I've just followed the tutorial in order to get vJoy Serial Feeder working on Linux (using in this case uinput instead of vJoy) and appliaction runs without problem. The problem comes when I want to select my transmitter serial port. I use an ESP32 inside my Taranis in order to bridge directly SBUS stream from transmitter to Laptop wirelessly via Bluetooth. For this I bind my ESP32 to a rfcomm, but I can't select rfcomm inside the application, only can select serial ports from ttyS0 to ttyS31. Any ideas for getting this working?? thank you!!

in-game disconnect issue

Hello,

serialfeeder shows changes, built in channel monitor works fine, changes appear on vjoy monitor too, the in game configuration works too, and the analog or digital signals appear to do their work, but whenever i push any button or move any variable resistor, it (forza horizon 5) says, that i need to reconnect my device, after i press enter, variable resistors work if i change the value really really slow, but any not slow change will result in in-game disconnection.

Thanks for the reply in advance!

Frsky PARA system compatibility

I have a Frsky x9 lite S with PARA system (bluetooth). I already connect it to the laptop but the sim doesn't detect it. I notice that a COM port was created. I asked Frsky if there is a driver for it but they say that feature is not supported.
If PARA system is used for wireless trainner, I think maybe this COM port has the stick input information and maybe the vjoy serial feeder could be used to convert it to a joystick like it do with other systems.
Any tips to try to achieve my goal?

Low latency 1/3ms but still laggy

Hello,
First of all thanks for your work it's awesome!
I´ve connected my Radio to the Pc following this tutorial https://youtu.be/TRnu2_TI9Vk and averything went fine, but I had high latency so I went and update the firm so now I have low latency 1/3ms which is great, but still laggy like If I have 1/2sec latency when you move the Joystic on the vJoySerialFeeder or liftoff game and I'm wondering if I done something wrong (https://imgur.com/svTAzm5.png). There are anything else I should do?
Thanks

IBUS Max Channels

I have the new 16 channel RX. Only 14 channels are setup so I think it is causing an overflow and I'm getting crazy channel values.
received_422468628394250

Feature: Auto connect to default profile.

Hi again, I'm thinking it would be good to have a "global" option to be able to select a profile that will automatically connect (to the serial port) when the program starts. Then it's just one one click and it's ready to be used in any game. And it's also possible to "script" the start of this program then directly after a game and it "just works". :)

failsafe (waiting for Serial data)

Hi I’am new here. I was able to connect and fly on simulator by SBUS and arduino setup until it stopped working and vjoy serial feeder failsafed. How do I fix it? my transmitter and receivers are linked properly.

Any way to make this work with mac

I'm fairly new to coding and want to connect my old drone RC to my MacBook, but vJoy isn't supported with macOS, so I was wondering if anyone knows an alternative to vJoy that would be supported on macOS and be able to read the data from my Arduino and make it an input source to my MacBook.

Glitch

hi,
I'm using arduino nano, jumper R1 as the receiver and Jumper T18. Just using the d3 as sbus port. The problem is every channel has a glitch output. I cannot run the simulator because of the glitch output. Anyone have the same experience like me?
Thank you

Import/Export config.

It would be nice to be able to import and export the config some how.
To be able to move it between computers and/or re installation of the system.
Also, comparability between operating systems would be great, export from Windows, import in to Linux.
Obviously you will have to select the "serial port" when the import is done. But you would get all the mappings of the axis and buttons. :)

Issues with Arduino Mega

Hey, sorry if this is a really basic question, but I'm having some issues with simple push buttons working on the Arduino Mega.

I have nothing connected to any analog pins, and nothing connected to Digital Bitmapped keys.
My buttons are simply connected to Pins 40-51.

Firstly, I found that in the Ardunio sketch I believe I need to define analog pins even if I don't have anything connected. So I have the following definitions:
#define NUM_ANALOG_INPUTS 16
byte analogPins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
#define NUM_DIGITAL_INPUTS 12
byte digitalPins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
#define NUM_DIGITAL_BITMAPPED_INPUTS 0
byte digitalBitmappedPins[] = {};

I've uploaded the sketch to the Arduino and connected to the Arduino in vJoySerialFeeder.

At the bottom it says I have 37 channels, which to me doesn't make sense? Shouldn't I have 28 Channels?

I believe Channel 1-16 are the analog channels and they are showing an input of 1023. Like I said I have nothing connected to the analog inputs on the Arduino anyway.

So I believe Channel 17 is Pin40 on the Arduino correct?

Input displays 0 and won't toggle if I push the button connected to the Arduino.

What am I doing wrong?

Serial Port Read Timeout when using FTDI adapter and SBUS Receiver

I have been trying several FTDIs and Receivers with my FrSky transmitter, and I was not able to get rid of that timeout. I also tried port speeds of 9600, 56000 to no avail. A also changed the parameters in the Program>profile>Failsafe Options and nothing changed. The port connects, the FTDI shows the TX/RX LEDs blinking, but still timing out. I assume that if the Feeder can be configured for SBUS, that would be SBUS "straight" from the RX, therefore, I see no reason for this setup not to work.
Any Ideas?

Potentiometers on Arduino Mega

I'm trying to get some slide potentiometers which are connected to an Arduino mega via A0, A1, and A2 pins. Should I list these in the sketch as 0-2 or should they be 54-56?

Serial Feeder to vJoy

Hi,
I've connected arduino to vJoySerialFeeder and after configuration all works
But when i set vJoy cofig and vJoy feeder, nothing seems to happen, and windows doesn't recognize anything. Any clue?
Thanks in advance :)

Possible port to linux?

Hi, is there any chance of an executable for linux (rpm or deb)? mainly interested in the multiwii part where you use the Flight controller connected to the PC.
or any advice for compilation if it would be doable with the same code?

Thank you for this work :)

High CPU usage

I'm using the feeder with an IBUS source I made myself (basically the ibus arduino code ported to SPIN). It sends 6 channels at almost 1000 Hz (yes I know, that's a little bit overkill).
When connected, vJoySerialFeeder uses 4 to 5% CPU (my PC has an AMD Ryzen 1600X hexacore CPU with hyperthreading (=12 logical CPUs), so that actually comes out to 60% of one thread(at 3.9 GHz!)). Some optimization should be done to reduce this.

IBUS failure to read with Native USB (U-series) Arduino variants (Leonardo and similar)

I just tested the following boards:

Failed: Arduino Leonardo (32u4)
Failed: Chinaclone Pro Micro (32u4)
Success: Arduino Uno (328p with 16u2-based serial bridge)
Success: Arduino Duemilanovae (328p with FTDI Serial Bridge Chip)
Success: Cypress PSoC (4200-family with Cypress Cy7C Serial Bridge Chip) (<- this one was an adventure: I had to re-implement the IBUS protocol library because it's only C not C++)

All devices showed the same output via serial monitor @ 115200 baud

the test code for Arduino:

#include <ibus.h>

const int NUM_CHANNELS = 3;

IBus ibus(NUM_CHANNELS);

const int16_t axisX = A0;
const int16_t axisY = A1;
const int numAxs = 2;
const int numBtn = 4;
const int numHat = 1;

const int sampavgsize = 10;
int16_t axisXsens[sampavgsize];
int16_t axisYsens[sampavgsize];
int16_t axisXsensAvg;
int16_t axisYsensAvg;

int btnTrg = 4;
int btnThm = 2;
int btnLft = 5;
int btnRgt = 3;

// hat switch direct buttons
int btnNorth = 6, btnEast = 7, btnSouth = 8, btnWest = 9;


int btnsPin[numBtn] = {btnTrg, btnThm, btnLft, btnRgt};
int btns[numBtn];
int hatPin[4] = {btnNorth, btnEast, btnSouth, btnWest};

int lastButtonState[4] = {0, 0, 0, 0};

void setup() {
  // put your setup code here, to run once:
  //digitalWrite(btnTrg, LOW);
  for (int i = 0; i < 4; i++)
    pinMode(btnsPin[i], INPUT_PULLUP);
  for (int i = 0; i < 4; i++)
    pinMode(hatPin[i], INPUT_PULLUP);

  pinMode(axisX, INPUT);
  pinMode(axisY, INPUT);
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  uint16_t currentButtonState = 0x00;


  do {
    int axisXsensSum = 0;
    int axisYsensSum = 0;

    for (int i = 0; i < sampavgsize; i++)
    {
      axisXsens[i] = analogRead(axisX);
      axisYsens[i] = analogRead(axisY);
    }
    for (int j = 0; j < sampavgsize; j++)
    {
      axisXsensSum += axisXsens[j];
      axisYsensSum += axisYsens[j];
    }
    axisXsensAvg = axisXsensSum / sampavgsize;
    axisYsensAvg = axisYsensSum / sampavgsize;
  } while (0);

  //  Serial.print(axisHsens);
  //  Serial.print("\t");

  for (int index = 0; index < 4; index++)
  {
    if ( !digitalRead(btnsPin[index]))
      currentButtonState |= 0x01 << index + 4; // buttons to second nibble, hat to first/low nibble
  }

  // currentButtonState &= 0xFFF0; //clear low nibble(redundant)
  for (int hatTest = 0; hatTest < 4; hatTest++)
  {
    if (!digitalRead(hatPin[hatTest]))
      currentButtonState |= 0x01 << hatTest;

  }
  ibus.begin();
  ibus.write((uint16_t)(1023 - axisXsensAvg));
  ibus.write((uint16_t)(1023 - axisYsensAvg));
  ibus.write(currentButtonState);
  ibus.end();
}

SBUS support

Can we help somehow with the SBUS support?

My idea is "use an arduino to convert/invert the SBUS protocol to standard TTL". SoftwareSerial can do that for us ;) Something like that:

#include <SoftwareSerial.h>

SoftwareSerial sbus(2, 255, true); // RX, TX(don't care), inverse_logic = true

void setup() {
  sbus.begin(115200);
  Serial.begin(115200);
}

void loop() {
  if (sbus.available()) { 
    Serial.write(sbus.read());
  }
}

The real logic will be placed in an new SbusReader class.

Awesome Project!

NOT an issue!

I found this via http://forum.arduino.cc/index.php?topic=515259 I haven't used it yet but I just can't stop me from making this comment. It is so overwhelming to see all your work. You have done an amazing job. Thank you for sharing it with the world. I went throgh the C# code, Sketch code and the documents. I can understand your great work because I have already developed a similar concept and using it for a personal project. But I haven't done mapping in any protocol way - that's the difference, instead I send serial strings from arduino for any analog or digital input and in the c# software it can be mapped to vjoy or mouse events or keyboard events.

Please keep up the good work. I'm going to try this out and will get back to you shortly. I would like to contribute as well. In fact I wanted to make my solution open source but I think your work is better than mine so I think I can use the knowledge I got from working with my solution - into your project. I hope you would welcome it.

Only few things I see missing is that, I have a rotary encoder which will translate to a vjoy axis. I think your solution doesn't have a built in way to to support rotary encoder but I think it can be done in the arduino sketch - it should be very easy.

Once again, Thank you for the project. This project will rock for sure!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.