How to invert the input to the output...nimrod77 wrote:nimrod77 wrote:Hi RamjetR I am building a set of diy rudder pedals and I want to use a Arduino micro for this. The 10bit code you have created is perfect for what I want. Would it be difficult to modify the code to only have Z axis? I plan on using a hall sensor as the input as shown here http://www.simpits.org/geneb/?p=299RamjetR wrote:Spent several days putting this together and since most of the knowledge I used came from here. It's good to give back to the community.
8 Axis, 10bits per axis
8 Buttons (active low)
Used to upgrade Logitech G25/G27 Pedals from 8bit to 10bit resolution. Works great. Please read the comments in the file if your unsure. And note that you need to put the USBAPI.h file in the correct place as it doesn't seem to override from within the IDE... also the HID.cpp file works fine from the sketch folder... odd..
Anywho... here is what I have been working on.
Enjoy![]()
Ramjet.
Any info or help will be gratefully received!
Thanks for the reply Ramjet. All very clear and after playing with the sketch you provided. I can not see any inversion code however. Where would I put that code if I needed to?
Thanks for all your work.
Code: Select all
joySt.rudder = 512; // Defaults to centre value if it is not enabled.
if(rudder_Enable) { // If enabled then update the value from the analog pin
joySt.rudder = analogRead(A0); // Default A1 pin
if(rudder_Invert) { // If Invert is enabled, then update the value inverted... ie swap max/min value
joySt.rudder = (1023) - analogRead(A0); // Default A0 pin
}
}